Re: XSLT bug
| From: | Ken Egervari | Date: | Thu, 18 Apr 2002 18:14:44 +0000 |
| Subject: | Re: XSLT bug | ||
| References: | 1 2 3 4 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82965@lists.php.net to get a copy of this message | ||
ahh, that makes sense. actually
<template match="text()">
</template>
would do it too. Cool.
----- Original Message -----
From: "Matt McClanahan" <cardinal@dodds.net>
To: "Ken Egervari" <ken@positive-edge.com>
Cc: <php-dev@lists.php.net>
Sent: Thursday, April 18, 2002 2:12 PM
Subject: Re: [PHP-DEV] XSLT bug
> On Thu, Apr 18, 2002 at 02:09:01PM -0400, Ken Egervari wrote:
>
> > I know that there is a workaround (which is obvious), but I just
> > wanted to report it. position() is supposed to return the position
> > of the node within the current node list. So i'd expect 1,2,3,4...N.
> > It's just strange why it would behave otherwise. As for doing it
> > this way? I'm just playing around and noticed it. this isn't
> > production code at all.
>
> This should've occured to me before sending the first reply, but, eh.
> Memory doesn't work so well so soon after waking up.
>
> It actually is reporting the correct position, if your XML is
> indendted. For example:
>
> <root>
> <application name="a" />
> <application name="b" />
> </root>
>
> has two text nodes in it at positions 1 and 3. So position() correctly
> reports the application nodes as being at 2 and 4. The only workaround
> for that is to take all the whitespace out of your XML:
>
> <root><application name="a" /><application name="b"
> /></root>
>
> Matt
>