[osis-core] Getting elements
Steve DeRose
osis-core@bibletechnologieswg.org
Thu, 15 Aug 2002 15:39:54 -0400
At 03:22 PM -0600 08/14/02, Todd Tillinghast wrote:
>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>
Hmmm. How does that help for use with a naive 'contains' function?
I'm not sure it's so bad to start with, if "Z.1" gets you all the
"Z.1.*" cases; but anyway that can be solved by adding token-boundary
awareness to one's search. For XPath itself, can't we just cat on
spaces and make it work?
//*[contains(concat(" ",@osisID," "),"Z.1")]
There's also the complication you pointed out that the match may or
may not be prefixed with a work and refsys -- that could be addressed
with yet gorier XPath, such as
//*[contains(concat(" ",@osisID," "),"Z.1")
or contains(concat(,@osisID," "),":Z.1")]
We'd still need something like this 'or' to manage the optionality of
refsys, even with the square brackets around, yes? How is just
matching on Z.1 helped by having the square brackets? it would still
match [Z.1.3] unless you matched for the brackets as well, but that
still doesn't cover the work/refsys prefix....
?
S
--
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