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

Infinte nesting with sorting

Subject: Infinte nesting with sorting
From: Oscar Rueda <orp@xxxxxxxxx>
Date: Fri, 11 Jan 2002 11:34:30 +0100
oscar rueda
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


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.