[xsl] Re: xsl:namespace

Subject: [xsl] Re: xsl:namespace
From: "Vladimir Nesterovsky" <vladimir@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 21 Feb 2009 09:02:28 +0200
> Can you please clarify on how to eliminate xsl:namespace in the example > I've
> provided?


If we take your code and expand it into a full example, it could look like this:
...

No. It could be a function building element with attribute of type xs:QName. The goal is to ensure that one can reconstruct QName with resolve-QName().


If you cannot reliably know that namespace declaration appears somewhere higher in the tree, then you neen to declare namespace at element level.

Consider:

<xsl:function name="t:create-schema-element" as="element()">
 <xsl:param name="name" as="xs:string"/>
 <xsl:param name="type" as="xs:QName"/>

<xs:element name="{$name}" type="{$type}">
<xsl:namespace name="{prefix-from-QName($type)}"
select="namespace-uri-from-QName($type)"/>
<xs:element>
<xsl:function>
--
Vladimir Nesterovsky
http://www.nesterovsky-bros.com/


Current Thread