Ouch. If this cant be done in xquery syntax then my goal of
de-serializing an XML representation using a XQuery example implementation is
out the door.
Here's my best shot ...
attribute
{ fn:QName( "U" , "P:N" ) }
{ my:IdType( "S"
) } (: wont work will it :( :)
Ok I admit I'm
totally stumped. *IS* there a way to re-animate this example using
XQuery (or XSLT?) ?
I have a feeling that my goal of providing a
reference implementation in XQuery will be impossible. Not even sure how
to get element type information re-animated.
I
think that in XSLT, the following comes close:
<xsl:attribute name="P:N" namespace="U" type="my:IdType"
select="'S'"/>
provided that the recipient has a schema (the correct schema) for
the global attribute declaration my:IdType. There are problems if the
type is anonymous (you might have to construct a variant of the original
schema in which all types have names). As for the isID property, it is ALMOST
redundant in XDM: it can in nearly all cases be inferred from the type
annotation. The exception is where IDness was established as a result of
DTD validation rather than schema validation. In that case, yes, I think
you're going to have difficulty reconstituting the original sequence using
tools written in XSLT or XQuery. (Actually, it hadn't occurred to me this was
one of your goals.)
XQuery 1.0 (unlike XSLT 2.0) doesn't allow validation against a
type name, and doesn't allow validation of individual
attributes.
Other limitations of using XSLT/XQuery
(a)
neither language gives you any way of creating unparsed
entities
(b)
XQuery 1.0 gives you no way of creating arbitrary namespace
nodes