a guest May 29th, 2017 200 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="">
  3.   <xsl:output method="xml" indent="yes"/>
  4.   <xsl:template match="*">
  5.     <xsl:copy>
  6.       <xsl:attribute name="fromRoot">
  7.            <xsl:value-of select="count(ancestor::*)"/>
  8.       </xsl:attribute>
  9.       <xsl:attribute name="preSib">
  10.            <xsl:value-of select="count(preceding-sibling::*)"/>
  11.       </xsl:attribute>
  12.       <xsl:attribute name="follSib">
  13.            <xsl:value-of select="count(following-sibling::*)"/>
  14.       </xsl:attribute>
  15.       <xsl:apply-templates select="@* | node()"/>
  16.     </xsl:copy>
  17.   </xsl:template>
  18. </xsl:stylesheet>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand