[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: namespaces problem
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|