This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: position in the tree


<xsl:template match="pregunta">
    <xsl:for-each select="ancestor::pregunta">
        <xsl:text>  </xsl:text>
    </xsl:for-each>
    <xsl:value-of select="normalize-space(text())"/>
    <xsl:text>&#10;</xsl:text>
    <xsl:apply-templates select="pregunta"/>
</xsl:template>

output:

1
  1.1
    1.1.1
    1.1.2

For HTML you can replace '  ' with '&#160;&#160;' and
'<xsl:text>&#10;</xsl:text>' with '<br/>'.

Regards,

Joerg

> if i have the next xml how can i determine where i am?
>
> <foro>
> <pregunta>1
> <pregunta>1.1
> <pregunta>1.1.1</pregunta>
> <pregunta>1.1.2</pregunta>
> </pregunta>
> </pregunta>
> <foro>
>
> how can i determine the number of child?
> the numbor of indentation?
> thanks


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]