Subject: [xsl] nodelist not recognised xsl file From: "Touchtel" <omprakashv@xxxxxxxxxxxxxxxxx> Date: Thu, 8 Sep 2005 23:19:26 +0530 |
Hi, Here's my xsl file. Lets say this works on an xml file and Iam interested in only one particular type of element in the file. These elements can be nested inside other elements and I have to follow links from one element to other elements using a key. My xslt is as follows: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:strip-space elements="*"/> <xsl:key name="gnt" match="vy" use="@name"/> <xsl:template match="docelement"> <!-- here I build nodeset and apply-templates --> <xsl:variable name="tree" select="document('')"/> <xsl:apply-templates select="someelement"> <xsl:with-param name="tree" select="$tree"/> </xsl:apply-templates> </xsl:template> <xsl:template match="someelement"> <xsl:param name="tree"/> <xsl:when test="@type='gbltype'> <xsl:variable name="temp" select="key('gnt', @type)"/> <xsl:apply-templates select="$temp/*"> <xsl:with-param name="tree" select="$tree"/> </xsl:apply-templates> </xsl:when> <xsl:when test="@type='rftp'"> <!-- The problem comes in the following line. The select doesn't evaluate saying $tree is not a nodelist --> <xsl:variable name="temp2" select="$tree/y[@name = 'rftp']"/> <xsl:apply-templates select="key('gnt', $refElement/@type)"/> </xsl:when> <xsl:otherwise> <!-- no need to use key --> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates /> </xsl:copy> </xsl:otherwise> </xsl:choose> <xsl:apply-templates select="childrenofsomeelement" > <xsl:with-param name="tree" select="$tree"/> </xsl:apply-templates> </xsl:template> </xsl:stylesheet> Regards, touchtel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] nodelist not recognised, Michael Kay | Thread | Re: [xsl] nodelist not recognised x, Joris Gillis |
RE: [xsl] note: Handling '&nbsp, Nathan Young \(natyo | Date | Re: [xsl] How to do this without up, Agnisys Technology \ |
Month |