RE: [xsl] document function support needed

Subject: RE: [xsl] document function support needed
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 23 Sep 2003 16:14:08 +0100
> In my template I created a variable value to 
> save the value of the desired node, but as soon as I crate 
> the variable:
> <xsl:variable name="value" 
> select="document($profile)/user/type/text()"/>
> I can not use the source document any more, am I defining the 
> variable in a wrong way? Please help, it is really urgent.

I suspect you are doing something like

<xsl:for-each select="$value">

in which case, inside the <xsl:for-each>, the current node is in the new
document, which means that any //x expressions also refer to the new

The usual remedy is to declare a global variable

<xsl:variable name="root" select="/"/>

and then you can always refer to the primary document as $root.

Michael Kay

 XSL-List info and archive:

Current Thread