[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

xpath problem
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.