xsl-list
[Top] [All Lists]

RE: indentation in xsl

2003-04-07 11:03:00
I am trying to do some recursive transforming with an 
identation. Currently I have no clue how to get started. My 
XML looks like this

<folder name="Test1">
  <folder name="SubTest1"/>
  <folder name="SubTest2">
     <folder name="SubSubTest2"/>
  </folder>
</folder>

Now I want to transform it with XSL but put a number of 
spaces in front depending on the depth of the particular folder.

<xsl:template match="folder">
  <xsl:for-each select="ancestor::*">
    <xsl:text>  </xsl:text>
  </xsl:for-each>
  <xsl:apply-templates/>
</xsl:template>

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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