[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
xpath problem
- From: Vincent De Groote <list.encelade@gmail.com>
- To: xml-dev <xml-dev@lists.xml.org>
- Date: Tue, 12 Jan 2010 18:09:04 +0100
Hello,
I have a xml file, simplified like this:
<a-file>
<x>
<a id='a1'/>
<a id='a2'/>
<bb>
<xx>
<a id='55'/>
<a id='66'/>
</xx>
<a id='a3'/>
<a id='a4'/>
<cc>
<a-ref id-ref='a2'/>
<a-ref id-ref='a4'/>
</cc>
</bb>
<a id='a7'/>
<a id='a8'/>
</x>
<x>
...
</x>
</a-file>
In this xml file, "a-ref/@id-ref" shoud reference a "a/@id" under its
"x" ascendant.
I wrote the xml schema grammar: the "a/@id" attributes are checked to
be unique within an "x" element, and the "a-ref/@id-ref" attributes
are checked to reference an existing "a/@id" attribute.
I have another constraint: an "a-ref/@id-ref" may only reference a
"a/@id" node which appears before him, within its "x" ascendant.
The referenced "a" node should exist in its preceding-siblings, the
preceding-siblings of its parent, ... up to the "x" ascendant:
In other words, in the example, the first "a-ref" element should only
reference one of the following ids: a1, a2, a3, a4, but not 55 or 66,
a7 or a8.
In xslt-2, i can write a function which checks this rule, but i cannot
find a way to write it in a grammar.
I will need to use embedded shematron rules for other checks, but i
cannot find an xpath to check this rule.
I'm working with saxon9-ee edition.
Any idea on how to do that ?
Thanks for your replies
Vincent De Groote
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]