Subject: [xsl] XSL Grouping Trouble From: "karthikeyan.balasubramanian" <karthikeyan.balasubramanian@xxxxxxxxxxxxx> Date: Thu, 30 Oct 2003 14:26:03 +0530 |
Hi, I have this xml and xsl below. Right now its grouping ok. I am just struck with one small problem 79-31-15 79 = chapter 31 = section 15 = unit right now grouping is happening combined[79-31-15] how about grouping just based on chapter and section[79-31] and not including 15 how do i make this happen? XML Content ============= <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="toc.xsl" type="text/xsl"?> <TABLE> <TBODY> <ROW> <ENTRY> <PARA>=MISSING</PARA> </ENTRY> <ENTRY> <PARA>79-31-15</PARA> </ENTRY> <ENTRY> <PARA/> </ENTRY> </ROW> <ROW> <ENTRY> <PARA>=MISSING</PARA> </ENTRY> <ENTRY> <PARA>79-31-16</PARA> </ENTRY> <ENTRY> <PARA>01</PARA> </ENTRY> </ROW> <ROW> <ENTRY> <PARA>=MISSING</PARA> </ENTRY> <ENTRY> <PARA>79-32-40</PARA> </ENTRY> <ENTRY> <PARA>01</PARA> </ENTRY> </ROW> </TBODY> </TABLE> XSL Content ========= <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method='xml' encoding='UTF-8' media-type='text/xml' indent='yes'/> <!-- ############################################################ --> <xsl:key name='CHAPTER' match='ROW' use='(ENTRY/PARA)[2]'/> <!-- ############################################################ --> <xsl:template match='/'> <xsl:for-each select="/TABLE/TBODY/ROW[generate-id(.)=generate-id(key('CHAPTER',(ENTRY/PAR A)[2]))]"> <xsl:sort select='(ENTRY/PARA)[2]' order='ascending' data-type='text'/> <h1>Section <xsl:value-of select='position()'/></h1> <table border='1'> <tr><td>Subject</td><td>Chapter Section</td><td>fig</td></tr> <xsl:for-each select='key("CHAPTER",(ENTRY/PARA)[2])'> <tr> <xsl:for-each select='ENTRY/PARA'> <td><xsl:value-of select='.'/></td> </xsl:for-each> </tr> </xsl:for-each> </table> </xsl:for-each> </xsl:template> <!-- ############################################################ --> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: RE: [xsl] Basic help needed., kaseykim | Thread | Re: [xsl] XSL Grouping Trouble, Mukul Gandhi |
RE: [xsl] Basic help needed., Michael Kay | Date | [xsl] Re: Converting specific child, Dimitre Novatchev |
Month |