You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Rob.Conde" <Ro...@ai-solutions.com> on 2008/07/30 20:12:33 UTC

XPath parsing bug?

I'm using Xalan 1.9

When compiling an xsl containing the following:

<xsl:template match="Items/value//@name">
  <!--some stuff here -->
</xsl:template>

I get the following error:

"A node test was expected.pattern = 'Items/value//@name' Remaining tokens
are: ('@' 'name')

This works with the .NET xpath processor however. Isn't this valid xpath?

FYI we found the following workaround match="Items/value//*/@name" which
while not a general substitude, works for our particular case.

Robert Conde



RE: XPath parsing bug?

Posted by "Rob.Conde" <Ro...@ai-solutions.com>.
Thanks David for the reply and workaround - always good to know you're not
crazy/dumb.

Rob

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Friday, August 01, 2008 7:56 PM
To: xalan-c-users@xml.apache.org
Subject: Re: XPath parsing bug?

Rob.Conde wrote:
> I'm using Xalan 1.9
> 
> When compiling an xsl containing the following:
> 
> <xsl:template match="Items/value//@name">
>   <!--some stuff here -->
> </xsl:template>
> 
> I get the following error:
> 
> "A node test was expected.pattern = 'Items/value//@name' Remaining tokens
> are: ('@' 'name')
> 
> This works with the .NET xpath processor however. Isn't this valid xpath?
> 
> FYI we found the following workaround match="Items/value//*/@name" which
> while not a general substitude, works for our particular case.
Yes, this is a bug.  However, you can use the attribute axis as a 
workaround:

Items/value//attribute::name

I've created a Jira issue and I'll be attaching a patch in a bit:

https://issues.apache.org/jira/browse/XALANC-680

Dave



Re: XPath parsing bug?

Posted by David Bertoni <db...@apache.org>.
Rob.Conde wrote:
> I'm using Xalan 1.9
> 
> When compiling an xsl containing the following:
> 
> <xsl:template match="Items/value//@name">
>   <!--some stuff here -->
> </xsl:template>
> 
> I get the following error:
> 
> "A node test was expected.pattern = 'Items/value//@name' Remaining tokens
> are: ('@' 'name')
> 
> This works with the .NET xpath processor however. Isn't this valid xpath?
> 
> FYI we found the following workaround match="Items/value//*/@name" which
> while not a general substitude, works for our particular case.
Yes, this is a bug.  However, you can use the attribute axis as a 
workaround:

Items/value//attribute::name

I've created a Jira issue and I'll be attaching a patch in a bit:

https://issues.apache.org/jira/browse/XALANC-680

Dave

Re: XPath parsing bug?

Posted by David Bertoni <db...@gmail.com>.
On Wed, Jul 30, 2008 at 11:12 AM, Rob.Conde <Ro...@ai-solutions.com>wrote:

> I'm using Xalan 1.9
>
> When compiling an xsl containing the following:
>
> <xsl:template match="Items/value//@name">
>  <!--some stuff here -->
> </xsl:template>
>
> I get the following error:
>
> "A node test was expected.pattern = 'Items/value//@name' Remaining tokens
> are: ('@' 'name')
>
> This works with the .NET xpath processor however. Isn't this valid xpath?
>
Yuck.  Two bugs in match patterns this week, and they've both been there
since day 1.

Yes, this is a bug.  Can you tell me if "attribute::name" works instead of
"@name"?


>
>
> FYI we found the following workaround match="Items/value//*/@name" which
> while not a general substitude, works for our particular case.

"Items/value/@name | Items/value//*/@name" is also a possible workaround.

Dave