[osis-core] Getting elements

Steve DeRose osis-core@bibletechnologieswg.org
Thu, 15 Aug 2002 15:43:28 -0400


At 11:10 AM -0400 08/15/02, Harry Plantinga wrote:
>I think Todd is right that there can be problems with looking
>for "Z.1" with XPath in the example below. However, I think there
>IS an XPath solution, without using the [] syntax.  The XPath
>code required is a bit messy, but that might be preferred by some
>to a messy XML document.  Also, I suspect the need won't arise
>very frequently, since the problem doesn't arise if you only have
>one osisID in an osisID attribute, and it's less likely to arise
>if you don't do much mixing of different reference schemes.
>
>So, here's how to search for Z.1 in the standard reference system
>using basic XPath.
>
>If you have a list of osisIDs like that below, but space separated
>instead of using the [] notation, you can find Z.1 in the default
>reference system by looking for osisID attributes
>   - equal to Z.1, or
>   - starting with "Z.1 ", or
>   - containing " Z.1 ", or
>   - ending with " Z.1".
>
>There are starts-with() and contains() string functions. There
>is no "ends-with()" function, but you can use substring() and
>string-length() to get the same behavior.

As you would expect from my posting that was after Harry posted this, 
but before I saw it, I concur. I think we should avoid complicating 
our syntax just to accommodate XPath (I really should have a word 
with those XPath editors about missing so glaring a case, though!)

>
>-Harry
>
>>  I think that the following solves ALL of the problems posed
>>  below from the earlier post.
>>
>>  <?xml version="1.0" encoding="UTF-8"?>
>>  <x osisID="[T:Z.A] [Z.1]">
>>	<y osisID="[T:Z.1.1] [Z.1.1]">Z.1.1</y>
>>	<y osisID="[T:Z.1.2] [Z.1.2]">Z.1.2</y>
>>	<y osisID="[T:Z.1.2] [T:Z.1.3] [T:Z.1.4] [Z.1.3]
>>  [Z.1.4.A]">Z.1.3 and Z.1.4</y>
>>	<y osisID="[T:Z.1.4] [T:Z.1.5] [Z.1.4.B] [Z.1.5]">Z.1.4
>>  and Z.1.5</y>
>>  </x>
>>


-- 

Steve DeRose -- http://www.stg.brown.edu/~sjd
Chair, Bible Technologies Group -- http://www.bibletechnologies.net
Email: sderose@speakeasy.net
Backup email: sjd@stg.brown.edu