[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: copying <xsl:stylesheet> tag to output xsl file

Subject: Re: copying <xsl:stylesheet> tag to output xsl file
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 2 Jan 2002 08:16:39 -0800 (PST)
xsl stylesheet tag
> I have this XSL file as below..i want to copy the <xsl:stylesheet> tag to
> the output xsl file, as i need the "my" namespace declaration in the
> generated output xsl file.

In order to have ***just*** the namespace declaration in the output, you don't need
to copy the xsl:stylesheet node (or any element, on which the given namespace is
defined) from the stylesheet. All you have to do is just copy the namespace node

Bellow is a modified identity stylesheet, which copies the "my" namespace
declaration to the top element of its output:

<xsl:stylesheet version="1.0"
    <xsl:output omit-xml-declaration="yes"/>
    <xsl:template match="/*">
        <xsl:copy-of select="document('')/*/namespace::*
        <xsl:apply-templates select="@*|node()"/>

    <xsl:template match="@*|node()">
        <xsl:apply-templates select="@*|node()"/>

When applied with Saxon 6.5 on this sample source xml:

        <b />
        <d />

the result is:

<t xmlns:my="http://mysite.com/mynamespace">

Hope this helped.

Dimitre Novatchev.

Do You Yahoo!?
Send your FREE holiday greetings online!

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.