[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Generating an XSD: namespace difficulty

Subject: RE: Generating an XSD: namespace difficulty
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 25 Mar 2005 11:32:20 -0000
xsd namespace
> 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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.