Re: [xsl] Setting default namespace in document output with <xsl:result-document>

Subject: Re: [xsl] Setting default namespace in document output with <xsl:result-document>
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 25 Apr 2011 23:03:15 +0100
On 25/04/2011 22:09, Steve Fogel wrote:
Hi, all.

I'm wondering how to set the default namespace in, say, the<html> tag of an output document when creating the document with<xsl:result-document>.

I would like the<html> tag to look like this:

<html xmlns=""; xml:lang="en" lang="en">

Right now it looks like this:

<html xml:lang="en" lang="en">

Then your code is wrong. If you show us your code, we can tell you where it is wrong.
If this were the main output document, then I could use "exclude-result-prefixes #default" in the stylesheet declaration, but I need the equivalent for<xsl:result-document>. Or maybe if I can get the namespace declaration in the<html> tag, then Saxon will not output it in the<meta> and<link> elements.
Yes, if you generate the html element in the correct namespace, the namespace declarations on its children will become redundant and therefore won't be generated by the serializer.

The exclude-result-prefixes declaration applies to all literal result elements, whichever result document they are writing to.
I'm using the version of Saxon 9.x that comes with the DITA Open Toolkit 1.5.2.

You can always find out what version of Saxon you are using using system-property('xsl:product-version')

Michael Kay

Current Thread