[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Referencing namespace prefixes within an XSD Schema generated by XSL transform


Subject: Re: [xsl] Referencing namespace prefixes within an XSD Schema generated by XSL transform
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 11 Aug 2006 22:33:12 +0100

if you were using xslt2 you could directly generate a namespace node
(and so a namespace declaration) with teh new xsl:namespace instruction
that works just like xsl:attribute but makes namespaces instead of
attributes, allowing both the nameand value to be generated dynamically.

In XSLT1 the usual trick is to just use xsl:attribute to put a spurious
attribute in the required namespace. so if you go
<schema>
 <xsl:attribute name="tns:wibble" namespace="{$targetNS}"/>
then you get a spurious tns:wibble="" attribute which I think the schema
validator will ignore and a namespace declaration for tns: will get
added automatically. If you need to remove the tns:wibble the you can do
this into a variable and then use xx:node-set extension to extact teh
element and its attributes and namespace nodes, but don't copy the
tns:wibble attribute.

David


Current Thread
Keywords