cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conal Tuohy <con...@paradise.net.nz>
Subject RE: Cleaning up unused namespace declaration
Date Mon, 09 Feb 2004 04:12:23 GMT
It's true that xsl:copy copies namespace declarations that are in scope. But
how do you have html elements inside the scope of a dir:directory element?
Are you using the XPathDirectoryGenerator? If so, or if you've transformed
the dir:file elements into inclusions, etc, then you might want to transform
the enclosing dir:file elements into xhtml at the same time. e.g. something
like:

<xsl:transform ... exclude-result-prefixes="dir">

	<xsl:template match="dir:file">
		<div class="file-content" id="{@name}">
			<xi:include href="@name"/>
		</div>
	</xsl:template>

	...

</xsl:transform>

Then when you come to xsl:copy the content in a later stage of the pipeline,
you won't have the dir namespace in scope any more.

Con


> -----Original Message-----
> From: Stefano Mazzocchi [mailto:stefano@apache.org]
> Sent: Monday, 9 February 2004 16:18
> To: dev@cocoon.apache.org
> Subject: Re: Cleaning up unused namespace declaration
>
>
>
> On 8 Feb 2004, at 21:37, Conal Tuohy wrote:
>
> > I don't know if you can configure the xml serializer to drop a
> > namespace
> > (seems unlikely, because such namespace might not be used until the
> > end of
> > the document, for all the serializer knows, so it wouldn't be safe
> > without
> > buffering the entire output document to check).
> >
> > But typically you should suppress the namespace in the XSLT which
> > converts
> > the dir:* content into xhtml, using the exclude-result-prefixes
> > attribute of
> > the xsl:stylesheet or xsl:transform element. This works for
> me - I just
> > checked! :-)
>
> Yeah, well, that doesn't help me because I have the namespace
> declarations already there in the document I want to process and it
> appears that xsl:copy copies over the namespace declarations
> everytime
> and it's not influenced by exclude-result-prefixes.
>
> And this isn't true if you use <xsl:element name="{name()}">, which
> feels hacky, but what the hell.
>
> [read http://www.xslt.com/xsl-list/2002-02/msg00026.html for
> more info]
>
> --
> Stefano.
>
>


Mime
View raw message