In XPath, * finds elements. To get text nodes too, use $expr/node() instead.

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Gary Larsen 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Thursday, November 9, 2017 at 1:31 PM
To: 'General MarkLogic Developer Discussion' 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Return nodes and text between nodes

Sorry if this is a bit off topic.

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

returns:

<refobj>REFOBJ1</refobj>
<refobj>REFOBJ2</refobj>

How do I access TEXT1 in a loop?

Thanks,
Gary


[Envisn]<http://www.envisn.com/>

Gary Larsen

| Envisn, Inc.<http://www.envisn.com/>

| 508.259.6465

| Envisn's IBM Cognos Blog<http://www.envisn.com/blog>






_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to