Subject: RE: [xsl] namespaces problem From: "Michael Kay" <mhk@xxxxxxxxx> Date: Wed, 29 Oct 2003 21:00:29 -0000 |
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: [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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] namespaces problem, belangour abdessamad | Thread | [xsl] Creating then using elements , Kathy Burke |
RE: [xsl] logical operators in *tes, Michael Kay | Date | RE: [xsl] logical operators in *tes, Kienle, Steven C [PG |
Month |