On Thu, 19 Sep 2002 [EMAIL PROTECTED] wrote:

> well, thank you, I basically know this, but to come back to the point:
> 
> I DO NOT want to learn how to make correct XHTML, what I want is, that
> Cocoon renders correct HTML.
> 
> *that* is the point!
> 
> any suggestions?

Sorry, I missed your initial message, so I'm not sure exactly
which aspect of the output is problematic for you.  As you
know (?) you can certainly configure the DOCTYPE with suitable
<doctype-public> and <doctype-system> within <map:serializer>;
the problem I have encountered is that, nonetheless (and using
the HTML serializer) the output retains xhtml namespace
attribute(s). If this is your problem, you can use an xslt to get
rid of them, as a penultimate pipeline stage:

   <map:match ... >
    ...
    <map:transform src="xslt/strip-xhtmlns.xslt"/>
    <map:serialize/>      
   </map:match>

where strip-xhtmlns.xslt is attached below.

(Of course namespace attributes will still appear if the input to
strip-xhtmlns has elements with any namespace other than xhtml;
and this use of xslt may be taking a "sledgehammer to crack a
nut" - with consequent performance impact....).

Does this help?

- Barry.

--------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
  xmlns:xlink="http://www.w3.org/1999/xlink";
  xmlns:xhtml="http://www.w3.org/1999/xhtml";
  exclude-result-prefixes="xlink xhtml">

<!-- Match the document to bootstrap... -->
<xsl:template match="/">
 <xsl:apply-templates />
</xsl:template>

<!-- For all xhtml elements we throw away the xhtml namespace;
     this is based on the assumption that the output
     will be HTML 4 (rather than XHTML). Note that we can't do
     this with xsl:copy which provides no mechanism to change the
     namespace on the copied nodes; so, instead, we use
     xsl:element to "manually" copy.  The "throwing away" of the
     namespace then occurs by virtue of the
     "exclude-result-prefixes" on the xsl:stylesheet element
     (above). I expected that the same effect would be achieved
     more "elegantly" via the namespace attribute on xsl:element
     (by giving it the empty string value "") - but that doesn't
     seem to work, so my expectations are evidently mistaken
     there! -->
<xsl:template match="xhtml:*">
 <xsl:element name="{local-name()}">
  <xsl:apply-templates select="@*|node()"/>
 </xsl:element>
</xsl:template>

<!-- 
  "Whereof we cannot speak, thereof we must be silent" 
  - Ludwig Wittgenstein.
-->

<xsl:template match="@*|node()">
 <xsl:copy>
  <xsl:apply-templates select="@*|node()"/>
 </xsl:copy>
</xsl:template>

</xsl:stylesheet>




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to