XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
help with schematron (axis in pattern must be child or attribute)

Hello. 

I have a question about Schematron.  I don't know if this is a suitable forum, but it's worth a shot.

I have an XML file with certain elements with an attribute that can take one of a set of values.  That set, however, change depending upon the position of the element.  Here's a simplified sample:

<root>
  <!-- the 1st matching element -->
  <element match="true" value="one"/>
  <element match="false">
    <element match="false">
     <!-- the 2nd matching element -->
      <element match="true" value="two"/>
    </element>
  </element>
  <element match="false/>
  <!-- the 3rd matching element -->
  <element match="true" value="three/>
  ...
</root>

I've been playing with XPath and the following expression will match all of the appropriate elements:

"/descendant-or-self::node()[@match='true']"

I can narrow this down by adding "[position()=n]" and then check in an <assert> that @value is one of the allowable terms.

In order to ensure that I don't miss out on any _nested_ elements (as with number 2 above) - the matching elements could be absolutely anyplace in the document - I search all descendants of the root element.

However, the above expression generates an error: "axis in pattern must be child or attribute". 

Does anybody have any ideas on how to solve this?

Many thanks for your help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS