Re: [xslt] XPath weirdness

On Thu, Sep 13, 2001 at 01:17:50PM +0200, robert wrote:
>  >On Thu, Sep 13, 2001 at 12:58:27PM +0200, robert wrote:
>  >> I'm observing the following with the latest libxml/libxslt versions.
>  >> <xsl:template match="categorynode[@catid = $catid]">
>  >>   <xsl:variable name="test" select="(parent::*)//categorynode[@catid = $catid]"/>
>  >
>  >  Dunno, use testXPath from libxml distribution to understand what's
>  >happening. I don't even understand what the expresssion is supposed to
>  >do.
> You don't really have to, XSLT #2 only differs in that the $test variable
> is inlined in the xsl:if-test.

  Sorry this is not obvious, I didn't see it.

> According to my common sense, that should
> give me the same output, but it doesn't.

  Seems there is a difference first does $test[1] while the second
does the equivalent of ($test)[1] . You introduce a reordering of the
node set at the () level and picking the first element may generate
a different result.


Daniel Veillard      | Red Hat Network  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]