RE: [xsl] Selecting from a node-set using variable path

Subject: RE: [xsl] Selecting from a node-set using variable path
From: Américo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Feb 2003 17:22:22 -0000
Hi Gary.

> This doesn't:
>   <xsl:variable name="t2" select="$myNodeSet/$myPath"/>

You can't do this directly, has others already told you. You have to use
some sort of evaluate function.

> 
> I'm using MSXML 4.0 and it's complaining with:
>   NodeTest expected here.
>   $myNodeSet/-->$<--myPath
> which makes sense.
> 
> 

With MSXML you can do something like:
<msxml:script language="Jscript" implements-prefix="user">
 function find(node,path) {
  return node.selectSingleNode(path);
 }
</msxml:script>

And then:
<xsl:variable name="t2" select="user:find($myNodeSet,$myPath)"/>

Hope that this helps you.


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


Current Thread