[xquery-talk] Return nodes and text between nodes
Ronald Bourret
rpbourret at rpbourret.com
Thu Nov 9 10:40:23 PST 2017
From the XPath specification:
- child::* selects all element children of the context node
- child::text() selects all text node children of the context node
- child::node() selects all the children of the context node, whatever
their node type
Since "child" is the default axis, you can omit it. Thus, $expr/* will
only return element children, as you have seen. If you want all
children, use $expr/node(). If you only want text children, use
$expr/text().
-- Ron
On 11/9/2017 10:27 AM, Gary Larsen wrote:
> Hi,
>
> Trying to process both node and text children in a for loop. For some
> reason this escapes me.
>
> let $expr :=
> <expression><refobj>REFOBJ1</refobj>TEXT1<refobj>REFOBJ2</refobj></expression>
>
> for $x in $expr/* return $x
>
> This returns:
>
> <refobj>REFOBJ1</refobj>
> <refobj>REFOBJ2</refobj>
>
> How do I access TEXT1 in a loop?
>
> Thanks,
>
> Gary
>
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
>
More information about the talk
mailing list