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

RE: Can you group in XSL?

Subject: RE: Can you group in XSL?
From: "Hewko, Doug" <Doug.Hewko@xxxxxxxxxxxxxxx>
Date: Thu, 12 Jul 2001 09:54:13 -0400
can you name the group
Thanks. Can someone please tell me what I am doing wrong? I went through the
tutorial and I get no output. I do not know if it's because Jeni is loading
her stylesheets from XML files, which I can not do because I want to re-use
my XML files, because she is using SAXON, or some other reason.

I am loading the XML and XSL files from a HTML document and using the
command "return xml.transformNode(xsl);" to give me the output. The code
works find without grouping, but I want to group by category.

Here's my XML file:
ml version="1.0" standalone="no"?> 
<glossary>
<glossaryitem type="dsafasf">
	<category>Category 1</category>
	<english_title>Title 1</english_title>
	<english_description>Description</english_description>
	<uri>Link</uri>
</glossaryitem>	
<glossaryitem type="dsafasf">
	<category>Category 1</category>
	<english_title>Title 2</english_title>
	<english_description>Description</english_description>
	<uri>URL</uri>
</glossaryitem>	
</glossary>

------------------------ XSL file --------------
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:key name="sorted-by-category" match="glossaryitemm" use="category" />
<xsl:template match="glossary">
<table>
    <xsl:for-each select="glossaryitem[count(. |
key('sorted-by-category',category)[1])=1]">
	<xsl:sort select="category" />
	<tr>
	<xsl:value-of select="category" />
	<xsl:for-each select="key('sorted-by-category', category)">
		<td>
		<ul>
		<li><a><xsl:attribute name="href"><xsl:value-of select="uri"
/></xsl:attribute>
		<strong><xsl:value-of select="uri" /></strong></a>
		<xsl:value-of select="english_description"/></li>
		</ul>
		</td>
	</xsl:for-each>
	</tr>
	<tr><td> </td></tr>
    </xsl:for-each>
</table>
</xsl:template> 
</xsl:stylesheet>
------------------------------------------------------------------------

-----Original Message-----
From: Rene de Vries [mailto:RdVries@xxxxxxxxxxx]
Sent: July 11, 2001 2:42 AM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Cc: 'Doug.Hewko@xxxxxxxxxxxxxxx'
Subject: RE:  Can you group in XSL?


Hi Doug,

Mike Kay answered to this question before:

Grouping isn't easy in XSLT 1.0 but you will find a full discussion of the
techniques at http://www.jenitennison.com/

More specific at http://www.jenitennison.com/xslt/grouping/index.html

Greetings Rene
   { @   @ }
        ^
      \__/

"You don't need eyes to see, you need vision!"

 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.