Subject: [xsl] position of the parents node -> XSLT1.1 From: news@xxxxxxxxxxx Date: Tue, 9 May 2006 14:12:46 +0200 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Matrix of differences wrt pre, Buchcik, Kasimier | Thread | RE: [xsl] position of the parents n, Michael Kay |
[xsl] Matrix of differences wrt pre, Buchcik, Kasimier | Date | RE: [xsl] position of the parents n, Michael Kay |
Month |