xsl-list
[Top] [All Lists]

Re: ClassCastException

2003-12-11 04:52:32

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



<Prev in Thread] Current Thread [Next in Thread>