RE: [xsl] Match nodes searching for attributes in children

Subject: RE: [xsl] Match nodes searching for attributes in children
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 18 Jan 2010 09:17:19 -0000
> I want to match a node A that has a child B with an @attr = 
> 1. I tried this, but it didn't work:
> 
> <xsl:template match="//A[B/@attr = 1]">
> 
> also this didn't work:
> 
> <xsl:template match="//A[B[@attr = 1]]">
> 

Both those are perfectly correct, though the "//" is redundant and best
avoided.

Your error must be in something you haven't shown us. Perhaps the elements
are in a namespace. Try posting a small but complete example.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Current Thread