|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL Grouping Trouble
I am not sure, if you can change *the XML structure*..
But if you can change the XML to --
<ENTRY>
<PARA>79-31</PARA>
<PARA>-16</PARA> <!-- or, <PARA>16</PARA> -->
</ENTRY>
Then you can achieve grouping easily, with key
definition --
<xsl:key name="CHAPTER" match="ROW/ENTRY[2]/PARA[1]"
use="."/>
Regards,
Mukul
--- "karthikeyan.balasubramanian"
<karthikeyan.balasubramanian@xxxxxxxxxxxxx> wrote:
> 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
>
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
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








