New cocoon user. Apologies if this is documented somewhere, but I can't
find it. 

I'm attempting to use XSL to translate XML documents, basically I'm
'skinning' the XML content with a variety of layout templates (XSL). The
current output format is HTML/XHTML.

I did a simple test and it worked great. However I ran into a kink when
I upgraded the template to a full blown layout. I'm using CSS and
JavaScript, which customarily are escaped using the standard SGML
comments <!-- -->. Since XML is SGML they're also obviously XML
comments, and as such are being (properly) stripped out of the template
and hence out of my output.

I tried embedding the comments in CDATA sections, but then they were
translated to character escapes. I then tried embedding escaped
characters &lt; and &gt; as in '&lt;!-- --&gt;'. Also to no avail.

I did some searching through the list archives and found ways to embed
comments in XSP, but not XSL. Is there a simple solution, other than
switching to XSP?

Thanks much for any help and pointers.

Corey


Pipeline Snippet:
        <map:pipeline>
            <map:match pattern="**/*.jcp" type="wildcard">
                <map:generate type="file" src="{1}/{2}.jcp"/>
                <map:transform type="xslt" src="{1}/template.jtp"/>
                <map:serialize/>
            </map:match>
        </map:pipeline>

Document Snippet:
<document>
    <title>Page Title</title>
    <content>
        <P>Stuff and whatnot.</P>
    </content>
</document>

XSL snippets: (cropped for clarity)
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
  <xsl:template match="document">
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <title><xsl:value-of select="title"/></title>
    <meta http-equiv="Content-Type" content="text/html;
charset=iso8859-1"/>
    <style type='text/css'><!-- 
      body {
        background: #FFFFFF url(../images/header/bg.gif)
      }

      //--></style>

      <script language = "javascript"><!--
        var path = '../';
        var section = 'programs';
        ...
        //--></script>
  </head>

  <body bgcolor="#ffffff" background="../images/header/ns3_bg.gif"
marginheight="0" marginwidth="0" topmargin="0" leftmargin="0"
onload="loadnav();init();">

...
<xsl:value-of select="content"/>
...

  </body>
</html>
  </xsl:template>
</xsl:stylesheet>



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

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

Reply via email to