Re: paths starting with "//" are invariant?

Subject: Re: paths starting with "//" are invariant?
From: Ray Waldin <rwaldin@xxxxxxxxxxx>
Date: Sun, 19 Dec 1999 22:35:41 -0800
"Mark D. Anderson" wrote:
> i've got a sizable template in which this:
>    <xsl:value-of select="//core:type[@id='publisher_type']/@id"/>
> 
> works correctly when in my main template, but finds no nodes when in
> a later template.
> 
> with my understanding, any path starting with "//" should produce
> the same thing regardless of where it is located, at least as long
> as it doesn't use any variables in it, and there is no use of xsl:document
> above it.

I'm only guessing here, but could it be that the namespace prefix core: maps to
different namespaces uris at these two points?  That's somewhat variable, isn't
it?

For example:

<xsl:template match="main" xmlns:core="something">
    <xsl:value-of select="//core:type[@id='publisher_type']/@id"/>
</xsl:template>

vs...

<xsl:template match="later" xmlns:core="something-else">
    <xsl:value-of select="//core:type[@id='publisher_type']/@id"/>
</xsl:template>

or worse...

<xsl:template match="worse">
    <xsl:value-of select="//core:type[@id='publisher_type']/@id"/>
</xsl:template>

I know it's a stretch, but these three templates return different results for
the same document.

-Ray


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


Current Thread