Attemping to build a template in XSLT to match on a specific Xpath case.
In this example XML document I want to match on all the text in the entire document except for in <x>
:
<root>
<tag1> I want this text </tag1>
<tag2> I want this text </tag2>
<x> I don't want to match on this text </x>
<tag3> I want this text </tag3>
</root>
Any ideas on this Xpath? I'm trying to build a template for it to transform my document for this specific case.
What I have come up with some far is something like this that's not working:
<xsl:template match="text()[not(matches(.,x))]">
Any ideas?
name()
, 2. Of the parent, 3. Usingmatches()
!!! which is not only less efficient than straight comparison, but also incorrect. Your second expression still has the reverse axis, which causes first going forward and then going backwords -- is this "efficient"? As for shortness, both your second expression and my expression occupy 22 bytes, but your first expression is 34 bytes long. Please understand and remember: We are here to promote best practices, and using a reverse axis when isn't such. – Dimitre Novatchev