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

Re: re-ordering nodes

Subject: Re: re-ordering nodes
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 20 Dec 2001 14:57:14 +0000
xsl ordering nodes
David,

> Jeni> Perhaps you can make it clearer what you want the stylesheet
> Jeni> to do.
>
> Jeni, I'm disapointed in you, you used to be able to reliably
> determine the spec given no information at all, have you lost this
> gift?

Actually I was being lazy. I think that what Srini wanted was:

<xsl:strip-space elements="*" />

<xsl:template match="list">
  <xsl:apply-templates select=".//o">
    <xsl:sort select="count(node())" data-type="number" />
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="o">
  <o>
    <xsl:apply-templates select="a | b | text()" />
  </o>
</xsl:template>

<xsl:template match="a | b">
  <xsl:copy>
    <xsl:copy-of select="@*" />
    <xsl:if test="o">
      <xsl:comment>
        <xsl:text> for </xsl:text>
        <xsl:for-each select=".//o[not(o)]">
          <xsl:value-of select="number()" />
          <xsl:if test="position() != last()">, </xsl:if>
        </xsl:for-each>
        <xsl:text> </xsl:text>
      </xsl:comment>
    </xsl:if>
  </xsl:copy>
</xsl:template>

At least it gives the required output for the single sample
document...

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.