CDATA support in XQuery (or displaying an attrib as a node)

Hello everyone,

I was wondering if XQuery fro Tamino 4.1.4.4 supports using CDATA?

I’d like to acomplish something like this:

for $p in input()/person[instances/instance/@id=$people/person/@iid]
where $p/@active=1
return
<![CDATA[<]]{local-name($p/instances/instance/@role)}<![CDATA[>]]


The idea is, that I have an attribute in the doc instance, and I’d like to return it as a node. I tried simply <{local-name($p/instances/instance/@role)}> which obviously didn’t work.

If you have any other suggestion on how to acomplish this, I’d apreaciate it greatly.

Thank you very much!

Peter Endisch

---------------------------------------
I’m a Zen Garden Maintenance Engineer
---------------------------------------

Hi,

Unfortunately Tamino 4.1.4 does not support CDATA constructors. It also does not support the construction of an element that gets its name from evaluating an expression.
But in your example query the result of calling the local-name() function is fixed. So you can specify your query by putting an constructor that creates a “role” element into the return clause.
The resulting query looks like this:

for $p in input()/person[instances/instance/@id=$people/person/@iid]
where $p/@active=1
return


If the result of calling local-name() is not fixed, I would suggest to construct for each extracted element an element with a fixed name that holds an attribute with the local-name of the extracted element.

Regards,

Thorsten

Thank you Thorsten for answering my question.

At least now I know what job will my XQuery do and what job will my XSLT (which gets the result of the XQuery) will do.

And thank you for being so active on this NS. I apreciate all your answers!

Peter Endisch

---------------------------------------
I’m a Zen Garden Maintenance Engineer
---------------------------------------