Re: [xsl] Selecting namespaces

Subject: Re: [xsl] Selecting namespaces
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2003 11:58:11 +0000
Hi,

> I have litteraly written the result, it did suceed. but the problem
> is that all the namespaces on the <xsl:stylesheet> element also
> appear on the result file.
>
> What do i have to do to select namspaces that have to appear on the
> result file and to forbid the others to appear?

You have to list the prefixes of the namespaces that you don't want to
appear in the output in the exclude-result-prefixes attribute of
<xsl:stylesheet>. For example, if you have:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xsd="http://www.w3.org/2001/XMLSchema";
                xmlns:my="MyDoc"
                xmlns:source="http://www.example.com/source";
                xmlns:another="http://www.example.com/another";>
...
</xsl:stylesheet>

and you don't want your output to contain namespace declarations for
the http://www.example.com/source or http://www.example.com/another
namespaces, then add an exclude-result-prefixes attribute with the
value "source another", as in:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xsd="http://www.w3.org/2001/XMLSchema";
                xmlns:my="MyDoc"
                xmlns:source="http://www.example.com/source";
                xmlns:another="http://www.example.com/another";
                exclude-result-prefixes="source another">
...
</xsl:stylesheet>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread