Re: [xsl] re-ordering nodes

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

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

<xsl:template match="a | b">
    <xsl:copy-of select="@*" />
    <xsl:if test="o">
        <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:text> </xsl:text>

At least it gives the required output for the single sample


Jeni Tennison

 XSL-List info and archive:

Current Thread