|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] nodelist not recognised xsl file
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
|
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
|

Cart








