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

grouping again

Subject: grouping again
From: Paul Levin <plevin@xxxxxxx>
Date: Wed, 19 Jan 2000 10:54:18 -0500
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


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.