xsl-list
[Top] [All Lists]

RE: Generating an XSD: namespace difficulty

2005-03-25 04:32:20
I can't figure out how to get the declaration of such a 
prefix into the
xs:schema result element since both the prefix and the URI to which it
refers are unknown until runtime.


The xsl:namespace instruction was added in XSLT 2.0 for this purpose. It
allows you to create a namespace node with a prefix and uri, just as you
would use xsl:attribute to create an attribute node.

The only way to achieve the same effect in XSLT 1.0 is a workaround: create
a result tree fragment containing an element in the relevant namespace, and
then copy the resulting namespace node:

<xsl:variable name="temp">
  <xsl:element name="{concat($prefix, ':dummy')}" namespace="{$uri}"/>
</xsl:variable>

<xsl:copy-of select="xx:node-set($temp)//namespace::*[name()=$prefix]"/>

Michael Kay
http://www.saxonica.com/





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>