Reverse Order

Sometimes you want to display a list of items in the reverse order than they appear in the document. http://www.biglist.com/lists/xsl-list/archives/200105/msg00236.html shows how:

    <xsl:apply-templates select="item">
      <xsl:sort select="position()" data-type="number" order="descending" />
    </xsl:apply-templates>

Non-breaking Space

Short answer: use &#160; instead of &nbsp;

Long answer: http://www.dpawson.co.uk/xsl/sect2/nbsp.html

Passthrough

This transform (which I learned from the guys that wrote the Maverick MVC framework) passes everything through unmolested.

        <xsl:template match="@*|node()">
                <xsl:copy>
                        <xsl:apply-templates select="@*|node()"/>
                </xsl:copy>
        </xsl:template>


This topic: Tech > TechNotes > ProgrammingNotes > XmlNotes > XsltNotes
Topic revision: r2 - 26 Jan 2007 - TobyCabot
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding The Caboteria? Send feedback