|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Can I group in three levels?
I have problems to generate the desired output of an XML using XSL. I want
to group in three levels
This is the XML to transform: <?xml version="1.0" encoding="UTF-8"?>
<ROWSET>
<ROW>
<ID>27835</ID>
<NUMBER>29715</NUMBER>
<PHONE>09876</PHONE>
<ACT>ACT34</ACT>
</ROW>
<ROW>
<ID>27835</ID>
<NUMBER>29716</NUMBER>
<PHONE>62784</PHONE>
<ACT>ACT87</ACT>
</ROW>
<ROW>
<ID>27835</ID>
<NUMBER>29716</NUMBER>
<PHONE>3333333</PHONE>
<ACT>ACT23</ACT>
</ROW>
<ROW>
<ID>27835</ID>
<NUMBER>29716</NUMBER>
<PHONE>3333333</PHONE>
<ACT>ACT111</ACT>
</ROW>
</ROWSET>First I want to group in a first level with the same ID,NUMBER. Inside of this first group, a second group with a second group with PHONE. And finally a third group, inside the second group with ACT. I'm not sure if I'm explainig clear. This is my XSL, that doesn't work <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="http://xml.apache.org/xslt"> <xsl:key name="level1" match="ROW" use="concat(ID,' ',NUMBER)" /> <xsl:template match="ROWSET"> <ROOT> <xsl:for-each select="ROW[count(. | key('level1', concat(ID,' ',NUMBER))[1]) = 1]"> <xsl:sort select="ID" /> <ID><xsl:value-of select="ID" /></ID> <NUM><xsl:value-of select="NUMBER" /></NUM> <xsl:for-each select="key('level1', concat(ID,' ',NUMBER))"> <xsl:sort select="PHONE" /> <PHONE_DATA> <PHONE><xsl:value-of select="PHONE" /></PHONE> <ACT_DATA> ???????? </ACT_DATA> </PHONE_DATA> </xsl:for-each> </xsl:for-each> </ROOT> </xsl:template> </xsl:stylesheet> My desired output for the first XML is:
How could I do this? _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail 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








