forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Re: XHTML source files
Date Mon, 28 Apr 2003 15:16:52 GMT
On Mon, Apr 28, 2003 at 04:34:49PM +0200, Saremba Andreas wrote:
> In Forrest's sitemap.xmap there is a rule that leaves HTML files untouched and just extracts
the body parts:
> 
> <!-- if the file is present as html, give that to the user... -->
> <map:act type="resource-exists">
>    <map:parameter name="url" value="content/xdocs/{1}/{2}.ehtml" />
>    <map:generate src="content/xdocs/{../1}/{../2}.ehtml"/>
>    <map:transform src="library/xslt/html2htmlbody.xsl" />
>    <map:transform type="linkrewriter" src="cocoon:/{../1}/linkmap" />
>    <map:serialize type="xml"/>
> </map:act>
> 
> I want to make use of this by using a valid XHTML document as source document:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>Titel</title>
> </head>
> <body>
>   <p>Body Text</p>
> </body>
> </html>
> 
> I have, of course, added the XHTML DTD to my project's resources so
> this document doesn't trigger an error, but the result in the website
> generated by Cocoon has empty content (except of the navigation etc.)
> Only if I delete the DOCTYPE declaration AND the namespace attribute
> everything works as expected.
> 
> (1) What is the reason?

Oh.. that would be because the html2htmlbody.xsl stylesheet matches
'html/body' without namespaces, and won't match XHTML.

Here's a version of library/xslt/html2htmlbody.xsl that accepts both html
and xhtml:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">

  <xsl:import href="copyover.xsl"/>
  <xsl:template match="/*[local-name()='html']">
    <xsl:apply-templates select="*[local-name()='body']"/>
  </xsl:template>

  <xsl:template match="/*[local-name()='html']/*[local-name()='body']">
    <div class="content">
      <xsl:apply-templates/>
    </div>
  </xsl:template>

</xsl:stylesheet>

Pretty ugly though.  If no-one suggests a better alternative I'll commit
this to CVS.

> (2) I edit my docs with XMetal so I don't want to strip the DOCTYPE
> (which leaves me without the advantages of XML validation). How do I
> have to change the sitemap?

Change it to do what?

> Generally, I think that the condemnation of XHTML as a suitable format
> for Forrest websites is a bit too harsh. There are situations when you
> need nothing more than HTML but the documentation doctypes are not
> sufficient (the tables in particular). XHTML should in my view be a
> format that is supported "out of the box" because Forrest is a very
> generic tool not just suited for documentation.

What kind of HTML support are you thinking of?  Currently we've got:

 - Raw src/documentation/content/*.html files are copied across directly
 - *.ehtml files have their <body> copied across directly, and menus/tabs
   added.
 - *.ihtml files are a subset of HTML that can be easily converted to
   doc-v11.

There's vague plans to evolve the primary Forrest format into a subset of
XHTML 2, and get out of the "proprietary doctype vendor" business.

Thanks for that bug report!

--Jeff


> Thanks,
> Andreas

Mime
View raw message