XML information pipe

Ihre Spezialisten für XML

Banner Werbung

XSLT 1.0 reference

case-order

Example 1 |


Example 1:


XML source: <AAA>
   <BBB>cc</BBB>
   <BBB>ff</BBB>
   <BBB>aa</BBB>
   <BBB>fff</BBB>
   <BBB>FFF</BBB>
   <BBB>Aa</BBB>
   <BBB>ccCCC</BBB>
</AAA>
XSLT stylesheet: <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:output
method="text"/>

<xsl:template match="/">
   <xsl:text>Ascending:</xsl:text>
   <xsl:apply-templates select="//BBB">
      <xsl:sort/>
   </xsl:apply-templates>
   <xsl:text>Descending:</xsl:text>
   <xsl:apply-templates select="//BBB">
      <xsl:sort order="descending"/>
   </xsl:apply-templates>
   <xsl:text>Lower-first:</xsl:text>
   <xsl:apply-templates select="//BBB">
      <xsl:sort case-order="lower-first"/>
   </xsl:apply-templates>
   <xsl:text>Upper-first:</xsl:text>
   <xsl:apply-templates select="//BBB">
      <xsl:sort case-order="upper-first"/>
   </xsl:apply-templates>
</xsl:template>
<xsl:template match="BBB">
   <xsl:value-of select="."/>
   <xsl:text/>
</xsl:template>

</xsl:stylesheet>
Output: Ascending: Aa FFF aa cc ccCCC ff fff
Descending: fff ff ccCCC cc aa FFF Aa
Lower-first: aa Aa cc ccCCC ff fff FFF
Upper-first: Aa aa cc ccCCC ff FFF fff
Back