[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

nodelist not recognised xsl file

Subject: nodelist not recognised xsl file
From: "Touchtel" <omprakashv@xxxxxxxxxxxxxxxxx>
Date: Thu, 8 Sep 2005 23:19:26 +0530
xsl nodelist
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.