Schematron and Java
Posted: Thu Feb 04, 2010 11:58 pm
Hello,
I have an xml file structured like this:
I validate this xml (I omitted the headers) with this schematron rule called from Java code:
The sequence index for nodeB is displayed correctly, while the sequence index of nodeA creates problems. It says the operator - cannot operate on a sequence than more than one number, meaning index-of returns more than one index for nodeA. How can this happen? How can avoid it?
Thanks!
I have an xml file structured like this:
Code: Select all
<root>
<nodeA>
<nodeB>
<nodeC>0</esiste>
<nodeD>abcd</id_tensione>
<nodeE>abcd</nodeE>
<nodeF>0</metri>
</nodeB>
<nodeB>
<nodeC>0</esiste>
<nodeD>abcd</nodeD>
<nodeE>abcd</nodeE>
<nodeF>0</nodeF>
</nodeB>
</nodeA>
<nodeA>
<nodeB>
<nodeC>0</nodeC>
<nodeD>abcd</nodeD>
<nodeE>abcd</nodeE>
<nodeF>0</nodeF>
</nodeB>
<nodeB>
<nodeC>0</nodeC>
<nodeD>abcd</nodeD>
<nodeE>abcd</nodeE>
<nodeF>0</nodeF>
</nodeB>
</nodeA>
</root>
Code: Select all
<iso:pattern>
<iso:rule context="nodeB">
<assert test="exists(nodeF) and nodeF > 0">nodeA[<value-of select="(index-of(../../nodeA, ..)-1)" />].nodeB[<value-of select="(index-of(../nodeB, self::node())-1)" />].nodeF#Some message.
</assert>
</iso:rule>
</iso:pattern>
Thanks!
