[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] XSL distinct group by date


Subject: RE: [xsl] XSL distinct group by date
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 24 Apr 2005 08:56:55 +0100

Are you familiar with

http://www.jenitennison.com/xslt/grouping

which gives the standard XSLT 1.0 approaches to grouping problems?

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Mindy McCutchan [mailto:karma@xxxxxxxxxxxxxx] 
> Sent: 24 April 2005 03:49
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] XSL distinct group by date
> 
> Hi Everyone,
> I'm very new to XML/XSL, so I'm struggling with something 
> that seems it
> should be fairly straightforward. With the following XML:
> 
> <documents>
> 	<casestudies>
> 		<study id="">
> 			<title />
> 			<date />
> 			<description><![CDATA[ ]]></description>
> 			<pdf />
> 			<logo />
> 		</study>
> 	</casestudies>
> 	<knowledgeadmin>
> 		<pressreleases>
> 			<pressrelease id="">
> 				<title />
> 				<date />
> 				<description><![CDATA[ ]]></description>
> 				<pdf />
> 			</pressrelease>
> 		</pressreleases>
> 		<whitepapers>
> 			<whitepaper id="">
> 				<id />
> 				<title />
> 				<date />
> 				<description><![CDATA[ ]]></description>
> 				<pdf />
> 			</whitepaper>
> 		</whitepapers>
> 	</knowledgeadmin>
> 	<news>
> 		<newsitem id="">
> 			<title />
> 			<date />
> 			<description><![CDATA[ ]]></description>
> 			<fulltext><![CDATA[ ]]></fulltext>
> 		</newsitem>
> 	</news>
> </documents>
> 
> I want to be able to get the different groups (newsitem, whitepaper,
> pressrelease) each grouped by year. Using news as example, I want to
> generate a list of distinct years in news/newsitem/date and 
> make that a URL
> that can be clicked to get the list of newsitems that were in 
> that year. I'm
> open to suggestions on how the date should be formatted. I'm 
> at a stage
> where I can restructure the XML as well, if that appears necessary.
> 
> I'm on Win 2K3 Web Edition server using VBScript. Here is my 
> transformation
> code, which should show the processors/versions used:
> 
> <%
> ' load list of news dats from xml
> Dim oXSL
> Dim myTemplate
> Dim myProc
> Dim oXML
> 				
> set oXML = server.createobject("Microsoft.XMLDOM")
> oXML.async = false
> oXML.load( dbPath )
> 				
> Set oXSL = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.4.0")
> oXSL.async = false
> oXSL.load Server.MapPath("xsl/date_list.xsl")
> 
> ' compliled XSL template
> Set myTemplate = Server.CreateObject("Msxml2.XSLTemplate.4.0")
> myTemplate.stylesheet = oXSL
> 
> Set myProc = myTemplate.createProcessor() myProc.input = oXML
> 
> myProc.output = Response
> myProc.transform()
> %>
> 
> I'm on a very tight deadline and having been 
> trying/researching for several
> hours for a solution to this, so any help would be much appreciated.
> 
> Thank you in advance!
> 
> Mindy


Current Thread
Keywords