|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] grouping again
Yesterday I posted that I could not get the following XSL to work, to do
the desired grouping.
I now know why. There is nothing wrong with the XSL. The problem is
that I was using a different computer, and a different version of
LotusXsl. The version that works is _0_18_5. The version that was not
working was _0_18_1.
For the sake of those who missed it, the XSL and XML are thus:
--------------- XSL -----------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<HTML>
<BODY>
<!-- group by ITEMTYPE -->
<xsl:for-each select="//ITEMTYPE[not(. = following::ITEMTYPE)]">
<!-- sort the ITEMTYPEs -->
<xsl:sort/>
<H1><xsl:value-of select="."/></H1>
<!-- get ITEMs matching the current ITEMTYPE -->
<xsl:for-each
select="//ITEM[descendant::ITEMTYPE=current()]">
<!-- sort the ITEMs -->
<xsl:sort select="NAME"/>
<P><xsl:value-of select="NAME"/></P>
</xsl:for-each>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
---------------- XML -------------
<?xml version="1.0"?>
<TOP>
<LEVEL1>
<LEVEL2>
<GROUP>
<ITEM>
<NAME>Name4</NAME>
<INFO>
<INFOTYPE>
<ID1>004</ID1>
<ID2>004</ID2>
<ITEMTYPE>TYPE2</ITEMTYPE>
</INFOTYPE>
</INFO>
</ITEM>
<ITEM>
<NAME>Name1</NAME>
<INFO>
<INFOTYPE>
<ID1>001</ID1>
<ID2>001</ID2>
<ITEMTYPE>TYPE1</ITEMTYPE>
</INFOTYPE>
</INFO>
</ITEM>
<ITEM>
<NAME>Name3</NAME>
<INFO>
<INFOTYPE>
<ID1>003</ID1>
<ID2>003</ID2>
<ITEMTYPE>TYPE2</ITEMTYPE>
</INFOTYPE>
</INFO>
</ITEM>
<ITEM>
<NAME>Name2</NAME>
<INFO>
<INFOTYPE>
<ID1>002</ID1>
<ID2>002</ID2>
<ITEMTYPE>TYPE1</ITEMTYPE>
</INFOTYPE>
</INFO>
</ITEM>
</GROUP>
</LEVEL2>
</LEVEL1>
</TOP>
------------ desired output (and output obtained with lotusxsl_0_18_5
------------
<HTML>
<BODY>
<H1>TYPE1</H1>
<P>Name1</P>
<P>Name2</P>
<H1>TYPE2</H1>
<P>Name3</P>
<P>Name4</P>
</BODY>
</HTML>
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








