[xquery-talk] retrieving node depending on its context

Michael Kay mhk at mhk.me.uk
Mon May 9 10:00:42 PDT 2005


Sorry for the incomplete explanation. $n is the <name> element that youa re
testing.

Personally I find it much more natural to do this using the
following-sibling axis, and I suspect that on products that offer the
following-sibling axis (are there still any that don't?) it's likely to be
more efficient.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Christian Wittern [mailto:wittern at kanji.zinbun.kyoto-u.ac.jp] 
> Sent: 09 May 2005 00:00
> To: Michael Kay
> Cc: talk at xquery.com
> Subject: Re: [xquery-talk] retrieving node depending on its context
> 
> "Michael Kay" <mhk at mhk.me.uk> writes:
> 
> > if (tokenize(../node()[. >> $n][1][self::text()], '\s')[1] eq 'and')
> 
> I guess I am just too dense for this:-)  Where does the $n come from?
> Is it something like
> 
> $x := <p>His name was <name>Christian</name> and he lived in
> <place>Kyoto</place>. Another <name>Name</name> here.</p>
> 
> for $n in $x/name
> 
> ...
> 
> but then I am lost.  I'd love to put all of this in a xpath predicate,
> but this does not seem to work.  
> 
> Could you please explain what you meant?
> 
> All the best,
> 
> Christian
> 
> -- 
> 
>  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