This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: re-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