tags:

views:

200

answers:

2

Is it possible to do the equivalent of the following in xslt:

.//TagA[./TagB/[@AttrA='AttrAValue'] = 'TagBValue']

This is failing within Visual Studio 2008 with the following error:

error: Unexpected token '[' in the expression.
.//TagA[./TagB/ -->[<-- @AttrA='AttrAValue'] = 'TagBValue']

Should this be working? Is this a problem in the MS implementation of XSLT, or is there a way I can get all TagA nodes that have a TagB node whose AttrA is equal to AttrAValue and whose TagB innerText is equal to TagBValue.

Thanks in advance for your help.

Tim

A: 

I think you need something before the offending [ to select a nodeset to then apply the attribute filter to.

On second thoughts do you even need the / before the offending [?

Si Keep
A: 

Thanks Si, you're right. The following worked:

.//TagA[./TagB[@AttrA='AttrAValue'] = 'TagBValue']

I'll blame it on the early morning!

Tim