1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="fils" match="balise" use=" substring(@name,1,(string-length(@name) - 1))"/>
<xsl:template match="/">
<racine>
<xsl:apply-templates select="/racine/balise[string-length(@name)=1]">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</racine>
</xsl:template>
<xsl:template match="balise">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="key('fils',@name)">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet> |
Partager