|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: grouping content
First of all, you need to close all of your Location tags:
<Location Area="A" Value="23"/>
Play with the enclosed files. It is just a variant of an recent
grouping problem (they seem to appear daily now).
Regards,
Dan
**************************
File: LocationGroups.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="LocationGroups.xsl"?>
<root>
<Location Area="A" Value="23"/>
<Location Area="A" Value="24"/>
<Location Area="A" Value="45"/>
<Location Area="A" Value="88"/>
<Location Area="B" Value="38"/>
<Location Area="B" Value="18"/>
<Location Area="C" Value="241"/>
<Location Area="C" Value="213"/>
</root>
File: LocationGroups.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="LocationGroups" match="Location" use="@Area"/>
<xsl:template match="/">
<xsl:for-each select="root/Location[@Area and
generate-id(.)=generate-id(key('LocationGroups',@Area))]">
<xsl:variable name="group" select="@Area"/>
Location <xsl:value-of select="$group"/><br/>
<xsl:for-each select="/root/Location[@Area=$group]">
·<xsl:value-of select="@Value"/><br/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="LocationGroups" match="Location" use="@Area"/>
<xsl:template match="/">
<xsl:for-each select="root/Location[@Area and
generate-id(.)=generate-id(key('LocationGroups',@Area))]">
<xsl:variable name="group" select="@Area"/>
Location <xsl:value-of select="$group"/><br/>
<xsl:for-each select="/root/Location[@Area=$group]">
·<xsl:value-of select="@Value"/><br/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








