xsl-list
[Top] [All Lists]

RE: namespaces problem

2003-10-29 14:00:29
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(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
belangour abdessamad
Sent: 29 October 2003 16:34
To: XSL-list
Subject: [xsl] 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



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