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

RE: namespaces problem

Subject: RE: namespaces problem
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 29 Oct 2003 21:00:29 -0000
xsl namespace targetnamespace
xmlns:my is not an attribute, it is a namespace declaration. It will be
output by the serializer if the xsd:element node in the result tree
contains a namespace node with name "my" and string value "MyDoc".

If the prefix and the uri are known statically, then generating the
namespace node is quite easy, you just have to declare the namespace in
the stylesheet and use a literal result element to create the xsd:schema
element. If they are only known dynamically, it's more tricky. In XSLT
2.0 there is an xsl:namespace instruction to do it. In 1.0, the
workaround is along the lines:

<xsl:variable name="dummy">
  <xsl:element name="{$prefix}" namespace="{$uri}"/>
</xsl:variable>

<xsd:schema>
  <xsl:copy-of select="xx:node-set($dummy)//namespace::*"/>

Generating the targetNamespace attribute is a doddle, it's an ordinary
attribute.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> belangour abdessamad
> Sent: 29 October 2003 16:34
> To: XSL-list
> Subject:  namespaces problem
> 
> 
> Hi all,
> I'm trying to automatically generate a schema using XSLT.
> How can i please generate the attributes 
> "targetNamespace="MyDoc" and xmlns:my="MyDoc" as in the example:
> --------------------------------------------------------------
> --------------
> ----------
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="MyDoc" xmlns:my="MyDoc" 
> elementFormDefault="qualified">
> --------------------------------------------------------------
> --------------
> ----------
> (The instruction ( <xsl:attribute 
> name="xmlns:my">MyDoc</xsl:attribute> ) generates an error.)
> 
> Thanks !!.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.