[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] ClassCastException


Subject: Re: [xsl] ClassCastException
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 11 Dec 2003 11:52:32 GMT

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



Current Thread
  • [xsl] ClassCastException
    • alana - Thu, 11 Dec 2003 16:37:05 +0530
      • David Carlisle - Thu, 11 Dec 2003 11:52:32 GMT <=
      • Michael Kay - Fri, 12 Dec 2003 11:26:57 -0000
      • <Possible follow-ups>
      • alana - Fri, 12 Dec 2003 11:08:46 +0530
        • David Carlisle - Fri, 12 Dec 2003 22:01:21 GMT
          • JCS - Sat, 13 Dec 2003 11:32:00 +1300
Keywords