[xslt] xslt and document namespaces



Goodday all

To improve readability of a resulting xml document, I tried to use
xsl:copy-of with the document function, as seen in
<http://groups.google.be/group/microsoft.public.xsl/browse_thread/thread
/a3bec746b3d393db/72f92f9c6e2a7432> and applied as below; instead of
declaring a namespace in each child element of rdf:Description, I would
like to have the namespace declarations in the rdf:Description element
itself:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:mbp="http://medibelplus.be/mbp/adticket/2.0/";
xmlns:adsml="http://adsml.org/xmlns/";
xmlns:gwg="http://gwg.org/jt/xmlns/";>
	<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes" omit-xml-declaration="yes"/>
	<xsl:template match="/">
		<xsl:element name="rdf:RDF">
			<xsl:element name="rdf:Description">
				<xsl:copy-of
select="document('')//namespace::*[ name() != 'xsl' ]"/>
				<xsl:attribute name="about"
namespace="{$rdf}"/>
				<xsl:apply-templates
select="//adsml:*"/>
				<xsl:apply-templates select="//gwg:*"/>
				<xsl:call-template name="color"/>
				<xsl:call-template name="size"/>
				<xsl:call-template name="bleed"/>
				<xsl:call-template name="mbp2"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>
	...
</xsl:stylesheet>

This works with tkxsltproc version 1.7 from
<http://tclxml.sourceforge.net/tkxsltproc.html> but the xsl:copy-of as
used above does not seem to generate any output using the latest library
port versions available at <http://www.zlatkovic.com/pub/libxml/>
(currently iconv-1.9.2, libxml2-2.6.26, libxslt-1.1.17 and zlib-1.2.3).

I do not know if this is actually a bug, but any help on how to
accomplish the mentioned reduction of namespace declarations would be
appreciated. I also tried setting a default namespace, but to no avail
here.

	Kind regards
	Roeland Muys


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]