Re: XPath question
"Chad Williamson" <[email protected]> Fri, 16 Jan 2004 16:56:40 -0700
| Newsgroups | gmane.text.xml.schematron |
|---|---|
| Message-ID | <[email protected]> |
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