xsl-list
[Top] [All Lists]

Re: [xsl] flat xml tree to indent one

2010-12-21 06:47:21
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>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>