" using XQuery? for instance I create an element with dynamic data - XQUERY let $sttag:= concat('<', '/') return con...">

How to print "<" and ">" using XQuery?

for instance

I create an element with dynamic data -

XQUERY
let $sttag:=  concat('<', '/')
return concat ($sttag, "newTag")

above XQuery returns the output as &lt;/newTaginstead </newTag.

is there any way to print "<" and ">" using xquery?

+3
source share
2 answers

I recommend using XQuery element constructors . Dynamic elements can be created using the calculated elements constructor :

element book { 
    attribute isbn {"isbn-0060229357" }, 
    element title { "Harold and the Purple Crayon"},
    element author { 
        element first { "Crockett" }, 
        element last {"Johnson" }
    }
}

leads to

<book isbn="isbn-0060229357">
    <title>Harold and the Purple Crayon</title>
    <author>
        <first>Crockett</first>
        <last>Johnson</last>
    </author>
</book>

(Example from the W3C XQuery specification )

In your case, you can use

element newTag { ... }
+2
source

- :

let $name := translate(concat('N', current-time()), ':','_')
  return
      element {$name} {}

<N21_26_40.708-07_00/>
+2

All Articles