[xquery-talk] retrieving node depending on its context
Christian Wittern
wittern at kanji.zinbun.kyoto-u.ac.jp
Mon May 9 08:52:22 PDT 2005
Philippe Michiels <philippe.michiels at ua.ac.be> writes:
> A quick solution:
>
> let $x := <p>His name was <name>Christian</name> and he lived in
> <place>Kyoto</place>.<name>test</name></p>
> return
> for $y in $x/descendant::name
> let $text := $y/parent::node()/child::text()[. >> $y][1]
> where fn:starts-with(fn:trim($text), " and")
> return $y
>
> Note that you have to take into account the leading space of the text node
> after the name-tag.
Thanks a lot, this seems to do exactly what I need!
I had to take out the fn:trim, since that does not seem to be a
standard function, but I can handle that otherwise with my data.
All the best,
Chris
--
Christian Wittern
Institute for Research in Humanities, Kyoto University
47 Higashiogura-cho, Kitashirakawa, Sakyo-ku, Kyoto 606-8265, JAPAN
More information about the talk
mailing list