And a little addition:
$node//text()[1]
…is an abbreviation for…
$node/descendant-or-self::node()/child::text()[1]
However, you are probably looking for:
$node/descendant::text()[1]
It’s completely fine to use parentheseses, as in this case, your query
will exactly be rewritten as shown above.
On Wed, Mar 2, 2016 at 8:28 PM, Jens Erat <jens.erat@uni-konstanz.de> wrote:
> This is a matter of precedence.
>
>> <li>{ $node//text()[1] }</li>
>
> Has the meaning of "return all text nodes, that are in first position of
> their encapsulating element". Consider the intermediate result after
> partial evaluation to be something like
>
> ("allo!"[1], "Il pleut des clous."[1])
>
> Applying parenthesis as you proposed in #4 resolves the issue:
>
>> <li>{ ($node//text())[1] }</li>
>
> resulting in
>
> ("allo!", "Il pleut des clous.")[1]
>
> instead.
>
> This is not an issue in $5, as all text nodes are stored in a sequence
> (which is flattened), and you return the first result of the flattened
> sequence.
>
> --
> Jens Erat
> Universität Konstanz
> Kommunikations-, Infomations-, Medienzentrum (KIM)
> Abteilung Basisdienste
> D-78457 Konstanz
> Mail: jens.erat@uni-konstanz.de
>