cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Yates <ceya...@stanford.edu>
Subject Re: Uncomment doctype declaration
Date Tue, 13 May 2003 21:19:25 GMT
Maybe you are not calling the comment() nodes from the root.  This works 
for me:

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

<xsl:template match="comment()[contains(.,'DOCTYPE')">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:template>

Anna Afonchenko wrote:

> Hi all.
> I have an HTML document with doctype declaration commented like this:
> <!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">-->
>  
> Now, when I output this file through cocoon pipeline, I want to apply 
> a stylesheet that will uncomment the doctype declaration. I don't want 
> to specify the doctype in serializer, because I don't know what 
> doctype should the document have.
>  
> So I wrote a small xsl with identity transformation and template for 
> uncommenting the doctype:
>  
> <xsl:template match="node()[self::comment()][contains(.,'DOCTYPE')]">
>     <xsl:value-of select="."/>
> </xsl:template>
>  
> But when I run this through Cocoon, I get the following error message:
>  
> *message* _javax.xml.transform.TransformerException: 
> javax.xml.transform.TransformerException: org.xml.sax.SAXException: 
> Invalid processing instruction name (saxon:warning)_
> *description* _org.apache.cocoon.ProcessingException: Could not read 
> resource file:/c:/my documents/work/applications/ub/yadsarahd5.html: 
> javax.xml.transform.TransformerException: 
> javax.xml.transform.TransformerException: 
> javax.xml.transform.TransformerException: org.xml.sax.SAXException: 
> Invalid processing instruction name (saxon:warning)_
>  
> I tried to disable output escaping:
> <xsl:value-of disable-output-escaping="yes" select="."/>
>  
> but then all I get in teh output is empty document with source:
> <?javax.xml.transform.disable-output-escaping 
> ><?javax.xml.transform.disable-output-escaping 
> ><?javax.xml.transform.disable-output-escaping 
> ><?javax.xml.transform.disable-output-escaping >
>  
> Is there a way to uncomment a doctype declaration so it will be valid 
> doctype for a document?
> Once again, I don't want to use the doctype declaration of the 
> serializer, I want the html page itself to contain the appropriate 
> doctype within a comment.
>  
> Thank you very much for help.
>  
> Anna



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message