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

XSL Grouping Trouble

Subject: XSL Grouping Trouble
From: "karthikeyan.balasubramanian" <karthikeyan.balasubramanian@xxxxxxxxxxxxx>
Date: Thu, 30 Oct 2003 14:26:03 +0530
xsl grouping
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

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.