Re: [xsl] flat xml tree to indent one

Subject: Re: [xsl] flat xml tree to indent one
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 21 Dec 2010 12:47:12 +0000
On 21/12/2010 12:30, Matthieu Ricaud-Dussarget wrote:
<p foo="foo_att" bar="bar_att" foobar="foobar_att">my text</p>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>


<xsl:template match="p"> <p> <xsl:apply-templates select="." mode="x"/> </p> </xsl:template>

<xsl:template match="*" mode="x">
 <xsl:param name="a" select="@*"/>
 <xsl:choose>
  <xsl:when test="exists($a)">
   <xsl:element name="{name($a[1])}">
    <xsl:apply-templates select="." mode="x">
     <xsl:with-param name="a" select="$a[position()!=1]"/>
    </xsl:apply-templates>
   </xsl:element>
  </xsl:when>
  <xsl:otherwise>
   <xsl:apply-templates/>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

</xsl:stylesheet>

Current Thread