This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Infinte nesting with sorting


Hello to all

I've got a XML file like this:
<Issue id="2"
<Chapter id="2">
    <Chapter id="1">
    <Chapter id="2">
        <Chapter id="2" />
        <Chapter id="1" />
    </Chapter>
    </Chapter>
</Chapter>
<Chapter id="1">
<Issue id="1">
................

I want the output indented and sorted by chapter id, just like
<Issue 1>
<Issue 2>
<Chapter 1>
<Chapter 2>
    <Chapter 1>
    <Chapter 2>
        <Chapter 1>
        <Chapter 2>
.....

I've tried with the following XSL, that goes well with the indenting and
sorting the issues

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
<xsl:template match="/">
<xsl:apply-templates select="//Issue" order-by="+@id"/>
<xsl:apply-templates select="//Chapter" />
</xsl:template>
<xsl:template match="Issue"><p>
<xsl:value-of select="@id" />
  <xsl:apply-templates  /></p>
</xsl:template>
<xsl:template match="Chapter">
   <BLOCKQUOTE>
<xsl:value-of select="@id" />
      <xsl:apply-templates />
   </BLOCKQUOTE>
</xsl:template>
</xsl:stylesheet>

But sorting the chapters looks painful, does anyone have a clue?

By the way, I'm using IE5, so I can't use <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

Thanks to all

Oscar Rueda







 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]