Hi Folks,

 

Given the following XML, what is the “best” way to test for the existence of 
values in a node?



let $list :=

<list>

                <item/>

</list>

 

 

How would I best check to see if the list has any element values?

 

If ($list/string()) then … ?

 

 

How would I count the number of items with values?

 

count($list/item)

 

 

What about for the following list? 

 

let $list :=

<list>

                <item/>

                <item i=”2”/>

                <item>

<key/>

<value/>

</item>

                <item>

<key>autumn</key>

<value>Autumn</value>

</item>

                

</list>

 

How would I iterate through the list of items with element values in any 
sub-node?

 

for $item in $list/item

where $item

return …

 

 

Were there changes between ML6 * ML7 that affected any of these evaluations?

 

 

What are some good resources for explaining this?  Thanks for any help!

 

 

Tim M.

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

Reply via email to