Schermatron: matching element element content with other element name
Posted: Tue May 09, 2017 5:19 pm
Hi,
I have the following XML document:
and need to write a schematron assertion testing that the text in element1: SmomeName matches the tag name of element4, without the namespace prefix. The SomeText and element tag name are different in every document.
I figured out that I need to point to the 2nd child of <element2> and probably use the NCName, but I have no idea how to put it all together.
Alternatively, I could point to the sibling of <element3>, which is always the same, but still I don't knoiw how to get the name of <element4>. None of the variants I tried worked so far.
Every help will be appreciated.
Ewa
I have the following XML document:
Code: Select all
<abc:root xmlns:abc="urn:xyz:abc" xmlns:hij="urn:xyz:def">
<element1>SomeName</element1>
<element2>
<element3>SomeText</element3>
<hij:element4>
<someMoreElements/>
</hij:element4>
</element2>
</abc:root>
I figured out that I need to point to the 2nd child of <element2> and probably use the NCName, but I have no idea how to put it all together.
Alternatively, I could point to the sibling of <element3>, which is always the same, but still I don't knoiw how to get the name of <element4>. None of the variants I tried worked so far.
Every help will be appreciated.
Ewa