[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] position of the parents node -> XSLT1.1
Hello List, I'm perfomring an XML to XML transformation. Therefore I m using a template by Michael Kay's book "XSLT 2nd Edition" page 194. <xsl:template match="@*|node()" mode="copy"> <xsl:copy> <xsl:apply-templates select="@*" mode="copy"/> <xsl:apply-templates mode="copy"/> </xsl:copy> </xsl:template> So far everythings works pretty fine. But since I'm doing a lille bit more than just copying nodes I need to know the position if the parents node of the current node in its parent node. Xpath's like this "parent::position()" dont'nt work. The only way I can think of a solution is to pass the position by a parameter. <xsl:template match="@*|node()" mode="copy"> <xsl:param name="parentsPos"/> <xsl:copy> <xsl:apply-templates select="@*" mode="copy"/> <xsl:apply-templates mode="copy"> <xsl:with-param name="parentsPos" select="position()"/> </xsl:apply-template> </xsl:copy> </xsl:template> But this does'nt look that smart to me. The only parants position I ever going to know by this is the position of a direct parent of a node. Is there a better way? thanks & with best regards, Jan
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|