Question

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.

Was it helpful?

Solution

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 [?

OTHER TIPS

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

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

I'll blame it on the early morning!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top