[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

XSL: Date/Month format display and sorting

Asked by baxleyb in Extensible Stylesheet Language Transformation (XSLT), Extensible Markup Language (XML)

Tags: date, xsl, sort, display, month

Hello,

I have an XML file that contains a number of links that need to be listed and displayed by year, month and then day.

I need an XSL file that can display the data from the XML file like this:

2008

January

1/13/2008 My URL
1/25/2008 My URL
1/31/2008 My URL

March

3/5/2008  My URL
3/10/2008 My URL
3/29/2008 My URL

<hr>------------------------------------------------------------------</hr>

2007

January

1/13/2007 My URL
1/25/2007 My URL
1/31/2007 My URL

March

3/5/2007  My URL
3/10/2007 My URL
3/29/2007 My URL

October

10/6/2007  My URL
10/13/2007 My URL
10/31/2007 My URL
-----------------------------------------------------------------
See the XML code snippet and the XSL code Snippet below.

Any assistance would be greatly appreciated!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
XML CODE:
 
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0" xmlns:myCompany="http://www.mycompany.com">
<channel>
<title>My Company News</title>
<link>http://www.MyCompany.com</link>
<description>My Company Corporation</description>
<language>en-us</language>
<pubDate>Tue, 11 Dec 2007 18:00:43 UTC</pubDate>
<docs>http://www.mycompany.com/rss</docs>
<generator>My Company</generator>
<item>
<title>Drought Conditions Worsen  Mandatory Water Restrictions Needed</title>
<link>http://www.mycompany.com/topics/releases/2007082701.php</link>
<description>Extreme drought conditions and record-breaking heat have resulted in the need for mandatory air restrictions.</description>
<pubDate>Mon, 27 Aug 2007 04:00:00 UTC</pubDate>
<myCompany:shortDate>8/27/2007</myCompany:shortDate>
<myCompany:moneyRelease>no</myCompany:moneyRelease>
<guid>http://www.mycompany.com/topics/releases/2007082701.php</guid>
</item>
<item>
<title>My Company CEO Says New York Can Become a Crossroads for Trinkets</title>
<link>http://www.mycompany.com/topics/releases/2007103101.php</link>
<description>The following are excerpts from a speech My Company Chairman, President and CWO Bob Bojangles gave today to the Broke Club of Nowhere in Nowhere's land.</description>
<pubDate>Wed, 31 Oct 2007 04:00:00 UTC</pubDate>
<myCompany:shortDate>10/31/2007</myCompany:shortDate>
<myCompany:moneyRelease>no</myCompany:moneyRelease>
<guid>http://www.mycompany.com/topics/releases/2007103101.php</guid>
</item>
<item>
<title>My Company Reports Third-Quarter 2053 Results</title>
<link>http://www.mycompany.com/topics/releases/2007110201f.php</link>
<description>My Company today reported we are broke and not making any money.</description>
<pubDate>Fri, 2 Nov 2007 04:00:00 UTC</pubDate>
<myCompany:shortDate>11/2/2007</myCompany:shortDate>
<myCompany:moneyRelease>yes</myCompany:moneyRelease>
<guid>http://www.mycompany.com/topics/releases/2007110201f.php</guid>
</item>
<item>
<title>My Company Names Two New Directors; Declares Quarterly Dividend</title>
<link>http://www.mycompany.com/topics/releases/2007102502.php</link>
<description>My Company announced that its board of directors increased its size from 10 to 12 members with the election today of Frick and Frack.</description>
<pubDate>Thu, 25 Oct 2007 04:00:00 UTC</pubDate>
<myCompany:shortDate>10/25/2007</myCompany:shortDate>
<myCompany:moneyRelease>no</myCompany:moneyRelease>
<guid>http://www.mycompany.com/topics/releases/2007102502.php</guid>
</item>
<item>
<title>My Company Names Two New Directors; Declares Quarterly Dividend-06</title>
<link>http://www.mycompany.com/topics/releases/2007102502.php</link>
<description>My Company announced that its board of directors increased its size from 10 to 12 members with the election today of Frick and Frack.</description>
<pubDate>Thu, 20 Oct 2006 04:00:00 UTC</pubDate>
<myCompany:shortDate>10/20/2006</myCompany:shortDate>
<myCompany:moneyRelease>no</myCompany:moneyRelease>
<guid>http://www.mycompany.com/topics/releases/2007102502.php</guid>
</item>
<item>
<title>My Company Names Two New Directors; Declares Quarterly Dividend-99</title>
<link>http://www.mycompany.com/topics/releases/2007102502.php</link>
<description>My Company announced that its board of directors increased its size from 10 to 12 members with the election today of Frick and Frack.</description>
<pubDate>Mon, 6 Apr 1999 04:00:00 UTC</pubDate>
<myCompany:shortDate>4/6/1999</myCompany:shortDate>
<myCompany:moneyRelease>no</myCompany:moneyRelease>
<guid>http://www.mycompany.com/topics/releases/2007102502.php</guid>
</item>
</channel>
</rss>
---------------------------------------------------------------
XSL CODE I HAVE SO FAR:
---------------------------------------------------------------
 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:myCompany="http://www.mycompany.com">
  <xsl:output omit-xml-declaration="yes" standalone="yes" media-type="text/xml" indent="yes"/>
  <xsl:template match="/rss">
  <xsl:for-each select="channel/item">
  	<xsl:sort select="substring(myCompany:shortDate,9,4)"/>
        <div class="date"><xsl:value-of select="myCompany:shortDate"/>
      	</div>
        <div class="headline">
		  <xsl:element name="a">
			<xsl:attribute name="href">
				<xsl:value-of select="link"/>
			</xsl:attribute>
			<xsl:attribute name="title">
				<xsl:value-of select="description"/>
			</xsl:attribute>
					<xsl:if test="contains(substring(myCompany:shortDate,1,2), '/')">
				M-There is a slash in the month
				</xsl:if>
	
				<br /><xsl:if test="contains(substring(myCompany:shortDate,3,2), '/')">
				D-There is a slash in the day
				</xsl:if>
	           </xsl:element>
	</div>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
[+][-]12/14/07 12:02 PM, ID: 20474033Accepted Solution

Your question has an Asker Certified™ answer! baxleyb verified that this solution worked for them--which means it will likely work for you, too. Click to view the solution free for 30-days now.

About this solution

Zones: Extensible Stylesheet Language Transformation (XSLT), Extensible Markup Language (XML)
Tags: date, xsl, sort, display, month
Sign Up Now!
Solution Provided By: Gertone
Participating Experts: 1
Solution Grade: A
 
[+][-]12/13/07 09:34 AM, ID: 20465958Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/13/07 09:40 AM, ID: 20465984Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/13/07 10:06 AM, ID: 20466154Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/13/07 10:07 AM, ID: 20466162Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/13/07 11:28 AM, ID: 20466823Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/13/07 01:14 PM, ID: 20467754Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/13/07 01:24 PM, ID: 20467836Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/13/07 01:29 PM, ID: 20467869Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/14/07 11:11 AM, ID: 20473740Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/17/07 08:38 AM, ID: 20485944Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/17/07 08:45 AM, ID: 20485996Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/20/07 08:54 AM, ID: 20508100Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/20/07 10:20 AM, ID: 20508734Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/27/07 11:48 AM, ID: 20536529Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/03/08 08:37 AM, ID: 20574141Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/03/08 09:18 AM, ID: 20574541Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/07/08 08:12 AM, ID: 20600490Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/11/08 08:48 AM, ID: 20867794Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20100308-EE-VQP-140 / EE_QW_2_20070628
Your technology problems solved.
Close See Plans and Pricing. Try it FREE for 30 days.