[osis-core] XPath and osisIDs

Todd Tillinghast osis-core@bibletechnologieswg.org
Wed, 5 Feb 2003 10:00:58 -0700


Troy,

//verse[starts-with(@osisID,"Gen.26.")] will give you all <verse>
elements in a document that have an osisID that starts with "Gen.26.".  

For your example you would say 

//*[substring(@osisID,1,7)="Gen.26."]  OR
//*[starts-with(@osisID,"Gen.26."] give the same result.

//*[substring-before(substring-after(@osisID, "."),".")="2"] will give
you all elements with an osisID that has a chapter identifier equal to
"2" and also has a verse identifier.

CAUTION: The previous statements do NOT deal with the cases where there
are multiple identifiers with an osisID and do NOT deal with the cases
where there is a prefix in front of the identifier.  For that you have
to use substring-after and ":" for the prefixed identifiers and contains
for the cases where there are multiple identifiers.  There were several
postings several months ago related to that issue.

//*[contains(@osisID, "Gen.26.")] will solve the cases where there are
multiple identifiers AND will give you instances from all reference
systems.  

If you have XMLSpy you they have an nifty XPath evaluator that gives
dynamic feed back related to XPath expressions as related to a document
as you type.

You will find all of the string related XPath functions in section 4.2
at http://www.w3.org/TR/xpath.  (starts-with, contains,
substring-before, substring-after, substring, ...)

Todd

> -----Original Message-----
> From: osis-core-admin@bibletechnologieswg.org [mailto:osis-core-
> admin@bibletechnologieswg.org] On Behalf Of Troy A. Griffitts
> Sent: Wednesday, February 05, 2003 12:02 AM
> To: osis-core@bibletechnologieswg.org
> Subject: [osis-core] [Fwd: Re: Thanks for info on sword XML, OSIS
format.]
> 
> Hey guys,
> 	Does anyone know if XPATH will allow pattern matching in
attribute
> values.  Something like:
> 
> 
> //[@osisID="Gen.26.*"]