Subject: Re: [xsl] Doctype and namespaces in source/generated files From: Mayo <mayo@xxxxxxx> Date: Fri, 28 May 2004 18:52:56 -0700 |
However, creating the html root as a literal result element (or via
xsl:element), used in combination with namespace declarations and
exclude-result-prefixes on the stylesheet element, will give you a certain
control over the namespace declarations to be added/omitted.
(Don't know about the rest of you over here, but simply copying the root in
this case seems to be asking for trouble --or at least, seems to complicate
things unnecessarily...)
(I'm not really concerted with removing them, as they do no harm, but it would certainly be cleaner. I'm more concerned about adding new ones in.)
Can you be a bit more specific about this? Do you mean that you introduce
new namespaces in the transform that are declared in none of the source
documents?
Again, if you create the root as a literal result element, you can add
custom namespace declarations to it by defining them on xsl:stylesheet (and
not adding their respective prefixes to the list in the
exclude-result-prefixes attribute).
Thanks, Mayo
<body> <p>xsl test1: <tpl:var/></p> </body> </html>
Stylesheet: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tpl="tpl:namespace" xmlns:xhtml="http://www.w3.org/1999/xhtml" exclude-result-prefixes="tpl">
<xsl:template match="*[not(namespace-uri())] | xhtml:*"> <xsl:element name="{local-name(.)}"> <xsl:apply-templates/> </xsl:element> </xsl:template>
<xsl:template match="tpl:var"> <xsl:element name="b"> <xsl:value-of select="'blarg'"/> </xsl:element> </xsl:template>
<!-- last catchall, to be safe --> <xsl:template match="tpl:*"/>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Doctype and namespaces in, Andreas L. Delmelle | Thread | [xsl] Calculating a Moving Average, John Reid |
Re: [xsl] Doctype and namespaces in, Mayo | Date | Re: [xsl] Doctype and namespaces in, G. Ken Holman |
Month |