[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Grouping and sorting nodes by the values of the 2

Subject: RE: Grouping and sorting nodes by the values of the 2 elements, and displaying only 1 in the HTML output
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 28 Jun 2001 17:24:07 +0100
RE:  Grouping and sorting nodes by the values of the 2
It's been a few days since the last grouping question on the list, so you
may not have seen the standard response:

See http://www.jenitennison.com/

and follow links to "grouping".

Mike Kay
Software AG

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of ghostrider
> Sent: 28 June 2001 16:15
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Grouping and sorting nodes by the values of the 2
> elements, and displaying only 1 in the HTML output
>
>
> Hi everyone,
>
> I'm trying to process the following XML file:
>
> <----------XML-------------------------------->
>
> <root>
> 	<Bugs>
> 		<Bug>
> 			<Category1>aaa</Category1>
> 			<Category2>111</Category2>
> 			<Description>Some text</Description>
> 		</Bug>
> 		<Bug>
> 			<Category1>aaa</Category1>
> 			<Category2>222</Category2>
> 			<Description>Some text</Description>
> 		</Bug>
> 		...
> 	</Bugs>
> </root>
>
> <----------XML-------------------------------->
>
>
>
> ... where Cat2 is a subcategory of Cat1.
>
>
> What I need is to get in the output is this:
>
>
> <----------HTML-------------------------------->
>
> <H1>aaa</H1>
>
>     <H2>111<H2>
>     <p>Some text</p>
>     ...
>
>     <H2>222<H2>
>     <p>Description text2</p>
>     ...
>
> <H1>bbb</H2>
>
>     <H2>333<H2>
>     <p>Some text</p>
>
> <----------HTML-------------------------------->
>
>
> So all Bugs should be sorted by Category1, then by Category2,
> but i don't want
> to output the value of Category1 for each Bug.
>
> The second issue is that I need to generate a linked table of
> contents based
> on Category1 element values:
>
> -------------
> Contents
> 	aaa
>         bbb
> 	ccc
> --------------
>
> Below is part of the XSL that I already have, and which
> outputs both cat1 and
> cat2 (sorted) for each Bug node.
>
> Someone please have a quick look at this - thanks!
>
> Armin
>
>
> <----------XSL-------------------------------->
>
> <xsl:template match="root">
>    <html>
>       <body>
> <xsl:apply-templates select="Bugs/Bug">
> 		<xsl:sort select="Category1" order="ascending" />
> 		<xsl:sort select="Category2" order="ascending" />
> </xsl:apply-templates>
>
>
> </body>
> </html>
>
>
> </xsl:template>
>
> <xsl:template match="Bug">
>
>  	<span >
>          <p>
>             <a name="Type"><xsl:value-of select="Category1"/></a></p>
> 	 <p><xsl:value-of select="Category2"/></p></span>
>
>   <div>
> 	<p><xsl:value-of select="Description"/></p></div>
>
> </xsl:template>
>
>
> <----------XSL-------------------------------->
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.