What's the s9apiest way to say text { $i } ?
Chapman Flack <chap-JULfBfA8satPFr4CO1/[email protected]> Sun, 21 Feb 2021 18:57:48 -0500
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <[email protected]> |
Hi, I'm trying to express this bit of XQuery directly in s9api:
typeswitch ( $i )
case $a as attribute(*) return text { $a }
default return $i
I think it would be something like this (i an XdmItem),
but what's the s9apiest way to write the ??? below?
if ( i instanceof XdmNode n ) {
if ( ATTRIBUTE != n.getNodeKind() )
return n;
return ??? /* make a text node from n.getTypedValue() */
}
else
return i;
Thanks!
Regards,
-Chap