Re: How to refer to xpath using variables?

"news.mozilla.org" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
1359734

Mlavikai wrote:

> I'm bit puzzled. The following example does not work with mozilla.
It shouldn't. Where did you get it?

> XML-file:
> ...
> <include-data xpath="/foo/bar" mode="foo" />
> ...
> 
> XSL-file:
> ...
> <xsl:template match="include-data">
>   <xsl:variable name="xpath"><xsl:value-of
> select="xpath"></xsl:variable>
>   <xsl:variable name="mode="><xsl:value-of
> select="mode"></xsl:variable>
>   <xsl:apply-templates select="$xpath" mode="$mode" />
> </xsl:template>
> ...
Do you mean:

<xsl:template match="include-data">
   <xsl:variable name="xpath" select="@xpath">
   <xsl:variable name="mode=" select="@mode">
   <xsl:apply-templates select="$xpath" mode="$mode" />
</xsl:template>
? If yes, than answer should be "No, you can't do it in XSLT 1.0". Mode 
should be QName, not expression. Also select attribute value should be a 
node-set-expression, but @xpath value isn't.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.