You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by cr...@apache.org on 2009/01/14 14:28:39 UTC
svn commit: r734387 - in /forrest/trunk: main/webapp/resources/schema/entity/
whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/
whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/
whiteboard/plug...
Author: crossley
Date: Wed Jan 14 05:28:19 2009
New Revision: 734387
URL: http://svn.apache.org/viewvc?rev=734387&view=rev
Log:
Enabled the output html serializer to be configurable to either xhtml or html.
Issue: FOR-1156
Added:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/how/configure-serializer.xml (with props)
Modified:
forrest/trunk/main/webapp/resources/schema/entity/symbols-core-v10.ent
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/strip-dispatcher-remains.xsl
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/site.xml
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/status.xml
Modified: forrest/trunk/main/webapp/resources/schema/entity/symbols-core-v10.ent
URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/resources/schema/entity/symbols-core-v10.ent?rev=734387&r1=734386&r2=734387&view=diff
==============================================================================
--- forrest/trunk/main/webapp/resources/schema/entity/symbols-core-v10.ent (original)
+++ forrest/trunk/main/webapp/resources/schema/entity/symbols-core-v10.ent Wed Jan 14 05:28:19 2009
@@ -26,6 +26,7 @@
<!-- Configure some sitemap components -->
<!ENTITY generator-html-jtidy-properties "WEB-INF/jtidy.properties">
+<!ENTITY dispatcher-output-serializer "xhtml">
<!ENTITY serializer-html-encoding "UTF-8">
<!ENTITY serializer-html-doctype-public "-//W3C//DTD HTML 4.01 Transitional//EN">
<!ENTITY serializer-html-doctype-system "http://www.w3.org/TR/html4/loose.dtd">
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap?rev=734387&r1=734386&r2=734387&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap Wed Jan 14 05:28:19 2009
@@ -83,6 +83,11 @@
<indent>yes</indent>
<omit-xml-declaration>yes</omit-xml-declaration>
</map:serializer>
+ <map:serializer name="html" mime-type="text/html" src="org.apache.cocoon.serialization.HTMLSerializer">
+ <doctype-public>&serializer-html-doctype-public;</doctype-public>
+ <doctype-system>&serializer-html-doctype-system;</doctype-system>
+ <encoding>&serializer-html-encoding;</encoding>
+ </map:serializer>
<map:serializer mime-type="image/png" name="svg2png"
src="org.apache.cocoon.serialization.SVGSerializer">
<!--<parameter name="background_color" type="color" value="#ff00ff"/>-->
@@ -180,10 +185,10 @@
<map:transform
src="lm://transform.xml.xml-namespace-stripped"
/>
- <map:transform
- src="lm://strip-dispatcher-remains-html.xsl"
- />
- <map:serialize type="xhtml" />
+ <map:transform src="lm://strip-dispatcher-remains-html.xsl">
+ <map:parameter name="serializer" value="&dispatcher-output-serializer;"/>
+ </map:transform>
+ <map:serialize type="&dispatcher-output-serializer;"/>
</map:match>
<!--
Last processing step.
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/strip-dispatcher-remains.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/strip-dispatcher-remains.xsl?rev=734387&r1=734386&r2=734387&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/strip-dispatcher-remains.xsl (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/strip-dispatcher-remains.xsl Wed Jan 14 05:28:19 2009
@@ -17,8 +17,25 @@
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:param name="serializer" select="'xhtml'"/>
<xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml">
+ <xsl:choose>
+ <xsl:when test="$serializer='html'">
+ <xsl:call-template name="do-html"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="do-xhtml"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="do-xhtml">
+ <html namespace="http://www.w3.org/1999/xhtml">
+ <xsl:copy-of select="html/head"/>
+ <xsl:copy-of select="html/body"/>
+ </html>
+ </xsl:template>
+ <xsl:template name="do-html">
+ <html>
<xsl:copy-of select="html/head"/>
<xsl:copy-of select="html/body"/>
</html>
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/how/configure-serializer.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/how/configure-serializer.xml?rev=734387&view=auto
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/how/configure-serializer.xml (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/how/configure-serializer.xml Wed Jan 14 05:28:19 2009
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN"
+ "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+ <header>
+ <title>Configure output serializer and doctype as xhtml or html</title>
+ </header>
+ <body>
+ <p>
+ The default html output serializer for Dispatcher-based projects is the
+ "xhtml" serializer and the document type declaration is "XHTML 1.0 Strict".
+ That is fine for applications which require xml input. For example, running Forrest as a back-end server and some other tool utilising the forrest output.
+ </p>
+ <p>
+ However for some websites it would be better to serve plain old html.
+ </p>
+ <p>
+ To do this, simply add the following line to your project's symbols file.
+ That file is at:
+ <code>PROJECT_HOME/src/documentation/resources/schema/symbols-project-v10.ent</code>
+ </p>
+ <source><![CDATA[...
+<!ENTITY dispatcher-output-serializer "html">
+...]]></source>
+ <p>
+ and then re-start Forrest.
+ </p>
+ <p>
+ The output will now be serialized as "html" and the document type declaration
+ will be "HTML 4.01 Transitional".
+ </p>
+ <note>
+ If your project does not yet have a "symbols file" then follow the
+ <a href="http://forrest.apache.org/faq.html#sitemap-entities">FAQ</a>.
+ </note>
+ <p>
+ To change the document type declaration (perhaps to "Strict"), copy
+ the relevant entities from the main configuration file at
+ <code>$FORREST_HOME/main/webapp/resources/schema/entity/symbols-core-v10.ent</code>
+ to your "symbols file" and over-ride them, i.e.
+ </p>
+ <source><![CDATA[...
+<!ENTITY serializer-html-doctype-public "-//W3C//DTD HTML 4.01//EN">
+<!ENTITY serializer-html-doctype-system "http://www.w3.org/TR/html4/strict.dtd">
+...]]></source>
+ <p>
+ and then re-start Forrest.
+ </p>
+ <p>
+ In HTML, the System Identifier is optional, so it can be set to be empty:
+ </p>
+ <source><![CDATA[...
+<!ENTITY serializer-html-doctype-public "-//W3C//DTD HTML 4.01//EN">
+<!ENTITY serializer-html-doctype-system "">
+...]]></source>
+ </body>
+</document>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/how/configure-serializer.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/site.xml?rev=734387&r1=734386&r2=734387&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/site.xml (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/documentation/content/xdocs/site.xml Wed Jan 14 05:28:19 2009
@@ -41,6 +41,7 @@
<structurer label="Structurer" href="how/howto-dispatcher-structurer.html"/>
<contracts label="Contracts" href="how/howto-dispatcher-contracts.html"/>
<perFolderThemes label="Per Folder/File Themes" href="how/perFolderThemes/index.html"/>
+ <configure-serializer label="Configure output serializer" href="how/configure-serializer.html"/>
</dispatcher>
<internals label="Internals" tab="int" href="int/">
<index label="Overview" href="index.html"/>
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/status.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/status.xml?rev=734387&r1=734386&r2=734387&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/status.xml (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/status.xml Wed Jan 14 05:28:19 2009
@@ -37,6 +37,10 @@
<changes>
<!-- Add new releases here -->
<release version="0.1" date="unreleased">
+ <action context="code" dev="DC" importance="high" type="add" fixes-bug="FOR-1156">
+ Enabled the output html serializer to be configurable to either xhtml or html.
+ See docs: <link href="site:configure-serializer">Configure output serializer</link>.
+ </action>
<action context="docs" dev="GM" importance="high" type="add">
Added an examples tab and section to show working examples
of how to add independant and plugin dependent contracts.
Re: svn commit: r734387 - in /forrest/trunk: main/webapp/resources/schema/entity/ whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/ whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/ whiteboard/plu
Posted by David Crossley <cr...@apache.org>.
Gavin wrote:
> > Author: crossley
> > Date: Wed Jan 14 05:28:19 2009
> > New Revision: 734387
> >
> > URL: http://svn.apache.org/viewvc?rev=734387&view=rev
> > Log:
> > Enabled the output html serializer to be configurable to either xhtml or
> > html.
> > Issue: FOR-1156
[ snip ]
> The above change :-
>
> > - <html xmlns="http://www.w3.org/1999/xhtml">
> > + <html namespace="http://www.w3.org/1999/xhtml">
>
> causes extra validation errors to appear :-
>
> Line 2, Column 16: there is no attribute "namespace".
> <html namespace="http://www.w3.org/1999/xhtml">
>
> Line 2, Column 1: Missing xmlns attribute for element html. The value should
> be: http://www.w3.org/1999/xhtml.
> <html namespace="http://www.w3.org/1999/xhtml">
>
> Can I change that line back?
I just did it. Sorry, that part was sloppy.
-David
RE: svn commit: r734387 - in /forrest/trunk: main/webapp/resources/schema/entity/ whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/ whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources/stylesheets/html/ whiteboard/plu
Posted by Gavin <ga...@16degrees.com.au>.
> -----Original Message-----
> From: crossley@apache.org [mailto:crossley@apache.org]
> Sent: Wednesday, 14 January 2009 11:29 PM
> To: svn@forrest.apache.org
> Subject: svn commit: r734387 - in /forrest/trunk:
> main/webapp/resources/schema/entity/
> whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/
> whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/resources
> /stylesheets/html/ whiteboard/plug...
>
> Author: crossley
> Date: Wed Jan 14 05:28:19 2009
> New Revision: 734387
>
> URL: http://svn.apache.org/viewvc?rev=734387&view=rev
> Log:
> Enabled the output html serializer to be configurable to either xhtml or
> html.
> Issue: FOR-1156
>
> Added:
> -->
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> + <xsl:param name="serializer" select="'xhtml'"/>
> <xsl:template match="/">
> - <html xmlns="http://www.w3.org/1999/xhtml">
> + <xsl:choose>
> + <xsl:when test="$serializer='html'">
> + <xsl:call-template name="do-html"/>
> + </xsl:when>
> + <xsl:otherwise>
> + <xsl:call-template name="do-xhtml"/>
> + </xsl:otherwise>
> + </xsl:choose>
> + </xsl:template>
> + <xsl:template name="do-xhtml">
> + <html namespace="http://www.w3.org/1999/xhtml">
> + <xsl:copy-of select="html/head"/>
> + <xsl:copy-of select="html/body"/>
> + </html>
> + </xsl:template>
> + <xsl:template name="do-html">
> + <html>
> <xsl:copy-of select="html/head"/>
> <xsl:copy-of select="html/body"/>
> </html>
>
The above change :-
> - <html xmlns="http://www.w3.org/1999/xhtml">
> + <html namespace="http://www.w3.org/1999/xhtml">
causes extra validation errors to appear :-
Line 2, Column 16: there is no attribute "namespace".
<html namespace="http://www.w3.org/1999/xhtml">
Line 2, Column 1: Missing xmlns attribute for element html. The value should
be: http://www.w3.org/1999/xhtml.
<html namespace="http://www.w3.org/1999/xhtml">
Can I change that line back?
Gav...