Search code examples
xmlxsltmsxml

Nested predicates in xslt


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.


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