RE: XPath question

"Denny, Allison (LNG-BET)" <[email protected]> Fri, 16 Jan 2004 19:09:47 -0500
Newsgroups gmane.text.xml.schematron
Message-ID <38A60BEBEF60234CB599A1FD4BE466E501185FC3@lnxbetexch00.lexis-nexis.com>
Hello,

> What I have done myself is set up multiple rule contexts each with their
own
> assert/reports in them.  Only the valid case will trigger the checks.

I think the problem I am having is how to set up the valid cases.  I can't
seem to create a <rule> that will match the absence of something.
Basically, is there a way to do:

<rule context="PUB-ENTRY and not(BIB/NOTICE)>

I want one <rule> for PUB-ENTRY that does have NOTICE (scenario 1), and
another for PUB-ENTRY that does not have NOTICE (scenario 2).

<rule context="PUB-ENTRY/BIB/NOTICE"> matches only scenario 1.
<rule context="PUB-ENTRY"> matches scenario 1 *and* 2.
<rule context="PUB-ENTRY and not(BIB/NOTICE)> matches only scenario 2, but
throws an error.

I hope this is clearer...

Thanks again,
Allison


-----Original Message-----
From: Chad Williamson [mailto:[email protected]]
Sent: Friday, January 16, 2004 6:57 PM
To: Denny, Allison (LNG-BET)
Cc: '[email protected]'
Subject: Re: [Schematron-love-in] XPath question




Hi Allison.

I'm a little unclear on exactly what you need to do here.  Perhaps you can
send
to sample xml snippets so I can better see what you are trying to
accomplish.(Although I won't be able to respond until Monday.)

What I have done myself is set up multiple rule contexts each with their own
assert/reports in them.  Only the valid case will trigger the checks.

I also have created large assert/report with many conditions, if this
attribute
="xxx" and this other attribute="yyy", or if sub-element exists and
ancestor::zzz/@aaa exists.

Perhaps what you are looking for is in these XPATH expressions:
http://www.w3.org/TR/xpath#location-paths

I hope this helps, chad the rad dad

____________________________________________________________

Chad Williamson, B.Sc. CE                                    BOW Networks
Inc.
Software Developer                                                 #200,
550-71
Avenue S.E.
TEL: (403) 640-8422
Calgary,
Alberta
FAX: (403) 253-8979                                                  T2H 0S6
e-mail: [email protected]
----------------------------------------------------------------------------
-----------------------------






"Denny, Allison (LNG-BET)" <[email protected]> on 16/01/2004
04:32:17
PM

To:   "'[email protected]'"
      <[email protected]>
cc:    (bcc: Chad Williamson/BOW Software Inc.)

Subject:  [Schematron-love-in] XPath question




Hello,

I'd like to create one schematron template that treats the same element
differently based on the presence of a child.  If the element has a certain
daughter, there are two validations.  If not, the same element has more
validations.  But I don't seem to be able to create a <rule> element
containing a 'not', and I can't think how else to do this.  Can anyone help?

<rule context="PUB-ENTRY/BIB/NOTICE[@WITH-DOCUMENT='NO']"> is fine
<rule context="PUB-ENTRY and not(BIB/NOTICE[@WITH-DOCUMENT='NO'])> throws an
error
<rule context="PUB-ENTRY"> + <rule
context="PUB-ENTRY/BIB/NOTICE[@WITH-DOCUMENT='NO']"> incorrectly runs all
validations

Thanks in advance!
Allison Denny

XML data analyst
LexisNexis


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Schematron-love-in mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/schematron-love-in





-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn