|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: namespace declaration when generating a stylesheet
> I am transforming the xml document into a stylesheet via
> another stylesheet.
>
>
> The result stylesheet needs any namespace declarations that
> were in the
> source (where they will be needed).
>
> How do I get them there (using XSLT)? I am stumped.
>
Namespace nodes from the source document will be copied into the result
document when you copy an element that owns such a namespace node; they will
also be generated if you create an element or attribute that refers to the
namespace.
Apart from that, the only way to get a namespace node into the result
document is to do an <xsl:copy[-of]> on a namespace node (and even then,
only if the XSLT processor implements the latest XSLT errata). One technique
is to create a result tree fragment containing the namespace node, and copy
it from there:
<xsl:variable name="rtf">
<xsl:element name="dummy" namespace="{$required-namespace}"/>
</xsl:variable>
<xsl:copy-of
select="xx:node-set($rtf)/dummy/namespace::*[.=$required-namespace]"/>
Mike Kay
Software AG
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
|

Cart








