xsl-list
[Top] [All Lists]

[xsl] How to force the XSLT processor to retain a namespace declaration on the root element?

2022-03-24 13:56:27
Hi Folks,

I have an XSLT program that processes an XML Schema.

I have a template rule for the root element (xs:schema)

<xsl:template match="xs:schema">
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";  
                         xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";>
        <xsl:apply-templates/>
    </xs:schema>
</xsl:template>

Notice that the template rule outputs the xs:schema element with two namespace 
declarations: one for the XMLSchema namespace and one for the DFDL namespace.

When I run the XSLT program, I get this output:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
     ...
</xs:schema>

Notice that the DFDL namespace declaration is gone. The XSLT processor has 
moved the declaration down to where the dfdl prefix is used. That is a problem 
because the DFDL processor insists on having the DFDL namespace declared on the 
root element (xs:schema) and the DFDL processor simply will not run unless it 
is there.

How do I force the XSLT processor to retain the DFDL namespace declaration on 
the root element?

/Roger
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--


<Prev in Thread] Current Thread [Next in Thread>