Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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" indent="yes"/>
- <xsl:template match="*">
- <xsl:copy>
- <xsl:attribute name="fromRoot">
- <xsl:value-of select="count(ancestor::*)"/>
- </xsl:attribute>
- <xsl:attribute name="preSib">
- <xsl:value-of select="count(preceding-sibling::*)"/>
- </xsl:attribute>
- <xsl:attribute name="follSib">
- <xsl:value-of select="count(following-sibling::*)"/>
- </xsl:attribute>
- <xsl:apply-templates select="@* | node()"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement