Schematron / schematron

Schematron "skeleton" - XSLT implementation
MIT License
93 stars 45 forks source link

Missing index on first of multiple children in human readable XPath #54

Open spoeschel opened 7 years ago

spoeschel commented 7 years ago

When the notation of SVRL's @location is set to a human readable XPath (XSLT parameter full-path-notation set to 2), the following happens:

If at any component of such a human readable XPath multiple children exist and the first one on that level is selected, the necessary index [1] is missing. This means that all children on that level are selected - instead of just the first one.

The reason is the test in line 833 of /trunk/schematron/code/iso_schematron_skeleton_for_saxon.xsl. This test can be fixed by extending the check (when to output the index) from the presence of preceding siblings to also the presence of following siblings.

So just from:

preceding-sibling::*[name(.)=name(current())]

to

preceding-sibling::*[name(.)=name(current())] or following-sibling::*[name(.)=name(current())]