ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
Re: [xsl] ClassCastException
by David Carlisle other posts by this author
Dec 11 2003 11:52AM messages near this date
RE: [xsl] ClassCastException | RE: [xsl] Different templates for same set of nodes
line 17 (mentioned in teh error) is

        <xsl:for-each select="$node[1]/ancestor-or-self::*"> 

that expression will only be valid if the variable $node contains a node set

but you are calling it as:
      <xsl:call-template name="node:xpath"> 
	        <xsl:with-param name="node" > 
                <xsl:value-of select="$nodew"/> 
                </xsl:with-param> 
	  </xsl:call-template> 

so teh parameter will never be a node set it will be a result tree
fragment corresponding to a root node with a single text node child with
value teh string value of the parameter nodew.


Most of the parameters are unused so you could  change that to

<xsl:template name="getvalue2" > 
        <xsl:param name="nodew"/> 
      <xsl:call-template name="node:xpath"> 
	        <xsl:with-param name="node"select="$nodew"/> 
	  </xsl:call-template> 

But nodew is not a node either, depite its name. It is aanother result
tree fragment with a string value that looks like an xpath but is not a
path to the system, its just a string.


<xsl:with-param name="nodew"> 
          /DATA/component/<xsl:value-of select="$reqnode"/> 
      </xsl:with-param> 

You probably want

<xsl:with-param name="nodew" select="/DATA/component/*[name()=$reqnode]"/> 

so that your parameter does contain a node set, although then this will
always be a set of element nodes, so most of the testing in the 
node:xpath template is a no-op.

David


-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
Thread:

Michael Kay
David Carlisle

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved