RE: [xsl] value-of select="" on source XML while using apply-templates in a variable

Subject: RE: [xsl] value-of select="" on source XML while using apply-templates in a variable
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 28 Jun 2004 17:02:36 +0100
> 
> I have a varible which I iterate using apply-templates.
> If I want t select an value from the source XML file, using
> value-of select="//XMLDOCUMENT/ELEMENT"
> I get nothing back.
> While not applying templates inside an variable, I always 
> have full access
> to the XML file data.
> 
> Does anybody has an idea how to solve this problem?
> 
Yes, anyone who's lurked on the list for more than a few days knows this
one: declare a global variable <xsl:variable name="root" select="/"/>, and
change your path expression to $root//XMLDOCUMENT/ELEMENT.

Incidentally, names beginning "XML" are reserved for future standardisation
(and in any case, calling something that isn't an XML document "XMLDOCUMENT"
seems designed to confuse the reader...).

Michael Kay


Current Thread