element() vs. node() in XQuery

前端 未结 3 1194
猫巷女王i
猫巷女王i 2021-02-10 04:04

Can someone tell me the exact difference between node() and element() types in XQuery? The documentation states that element() is an eleme

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-10 04:32

    node() is an element, attribute, processing instruction, text node, etc.

    But data() converts the result to a string, which isn't any of those; it's a primitive type.

    You might want to try item(), which should match either.

    See 2.5.4.2 Matching an ItemType and an Item in the W3C XQuery spec.

    Although it's not shown in your example code, I assume you are actually returning a value (like the $value you are working with) from the local:myFunction.

提交回复
热议问题