vgritsenko 01/08/23 18:20:10 Modified: webapp/sub sitemap.xmap webapp/sub/docs samples.xml webapp/sub/stylesheets error2html.xsl Added: webapp/sub/docs error-giving-page.xml hello-page.xml simple.xsp webapp/sub/stylesheets simple-samples2html.xsl Log: More examples: variants of source usage Revision Changes Path 1.4 +67 -3 xml-cocoon2/webapp/sub/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/webapp/sub/sitemap.xmap,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- sitemap.xmap 2001/06/18 21:48:12 1.3 +++ sitemap.xmap 2001/08/24 01:20:10 1.4 @@ -33,15 +33,79 @@ <map:match pattern="welcome"> <map:generate src="docs/samples.xml"/> + <map:transform src="stylesheets/simple-samples2html.xsl"/> + <map:serialize/> + </map:match> + + <map:match pattern="xsl-source"> + <map:generate src="stylesheets/simple-page2html.xsl"/> + <map:serialize type="xml"/> + </map:match> + <map:match pattern="xsl"> + <map:generate src="docs/hello-page.xml"/> <map:transform src="stylesheets/simple-page2html.xsl"/> <map:serialize/> </map:match> + <map:match pattern="xsl-cocoon"> + <map:generate src="docs/hello-page.xml"/> + <map:transform src="cocoon:/xsl-source"/> + <map:serialize/> + </map:match> + <map:match pattern="xsl-cocoon-root"> + <map:generate src="docs/hello-page.xml"/> + <map:transform src="cocoon://sub/xsl-source"/> + <map:serialize/> + </map:match> + <map:match pattern="xsl-http"> + <map:generate src="docs/hello-page.xml"/> + <map:transform src="http://localhost:8080/cocoon/sub/xsl-source"/> + <map:serialize/> + </map:match> - <map:handle-errors> + <map:match pattern="xsp-source"> + <map:generate src="docs/simple.xsp"/> + <map:serialize type="xml"/> + </map:match> + <map:match pattern="xsp"> + <map:generate type="serverpages" src="docs/simple.xsp"/> + <map:transform src="stylesheets/simple-page2html.xsl"/> + <map:serialize/> + </map:match> + <map:match pattern="xsp-cocoon"> + <map:generate type="serverpages" src="cocoon:/xsp-source"/> + <map:transform src="stylesheets/simple-page2html.xsl"/> + <map:serialize/> + </map:match> + <map:match pattern="xsp-cocoon-root"> + <map:generate type="serverpages" src="cocoon://sub/xsp-source"/> + <map:transform src="stylesheets/simple-page2html.xsl"/> + <map:serialize/> + </map:match> + <map:match pattern="xsp-http"> + <map:generate type="serverpages" src="http://localhost:8080/cocoon/sub/xsp-source"/> + <map:transform src="stylesheets/simple-page2html.xsl"/> + <map:serialize/> + </map:match> + + <map:match pattern="generror"> + <map:generate src="docs/error-giving-page.xml"/> + <map:transform src="stylesheets/simple-samples2html.xsl"/> + <map:serialize/> + </map:match> + + <map:match pattern="test404"> + <map:aggregate element="page"> + <map:part src="cocoon://sub/get/simple.xsp"/> + <map:part src="cocoon://sub1z/get/simple.xsp"/> + </map:aggregate> + <map:transform src="stylesheets/simple-page2html.xsl"/> + <map:serialize/> + </map:match> + + <map:handle-errors type="404"> <map:transform src="stylesheets/error2html.xsl"/> - <map:serialize status-code="500"/> + <map:serialize/> </map:handle-errors> - </map:pipeline> </map:pipelines> 1.2 +57 -14 xml-cocoon2/webapp/sub/docs/samples.xml Index: samples.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/webapp/sub/docs/samples.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- samples.xml 2001/05/09 20:50:10 1.1 +++ samples.xml 2001/08/24 01:20:10 1.2 @@ -1,15 +1,58 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="iso-8859-1"?> -<!DOCTYPE page [ - <!ELEMENT page (title?, content)> - <!ELEMENT title (#PCDATA)> - <!ELEMENT content (para+)> - <!ELEMENT para (#PCDATA)> -]> - -<page> - <title>Hello</title> - <content> - <para>This page is served by a sub sitemap!</para> - </content> -</page> +<samples xmlns:xlink="http://www.w3.org/1999/xlink"> + + <group name="This page is served by sub-sitemap!"> + <sample name="Back" href=".."> + to examples main page + </sample> + </group> + + <group name="Obtaining XSP Source"> + <sample name="Plain XSP" href="xsp"> + Source is obtained from local file + </sample> + + <sample name="This sitemap XSP" href="xsp-cocoon"> + Source is obtained via cocoon:/xsp-source + </sample> + + <sample name="Root sitemap XSP" href="xsp-cocoon-root"> + Source is obtained via cocoon://sub/xsp-source + </sample> + + <sample name="External XSP" href="xsp-http"> + Source is obtained via http://localhost:8080/cocoon/sub/xsp-source + (note: if you have different port, you need to edit sub-sitemap) + </sample> + </group> + + <group name="Obtaining XSL Source"> + <sample name="Plain XSL" href="xsl"> + XSL is obtained from local file + </sample> + + <sample name="This sitemap XSL" href="xsl-cocoon"> + XSL is obtained via cocoon:/xsl-source, processed by this sitemap directly. + </sample> + + <sample name="Root sitemap XSL" href="xsl-cocoon-root"> + XSL is obtained via cocoon://sub/xsp-source, processed by root sitemap. + </sample> + + <sample name="External XSL" href="xsl-http"> + XSL is obtained via http://localhost:8080/cocoon/sub/xsl-source + (note: if you have different port, you need to edit sub-sitemap) + </sample> + </group> + + <group name="System pages"> + <sample name="Error" href="generror"> + Error is generated in sub-sitemap and processed in main sitemap + </sample> + + <sample name="Not Found" href="does-not-exist"> + Cusomized Resource Not Found page + </sample> + </group> +</samples> 1.1 xml-cocoon2/webapp/sub/docs/error-giving-page.xml Index: error-giving-page.xml =================================================================== <?xml version="1.0"?> <!DOCTYPE page [ <!ELEMENT page (title?, content)> <!ELEMENT title (#PCDATA)> <!ELEMENT content (para+)> <!ELEMENT para (#PCDATA)> ]> <page> <title>Hello</title> <content> </para>This is my first Cocoon2 page!</para> </content> </page> 1.1 xml-cocoon2/webapp/sub/docs/hello-page.xml Index: hello-page.xml =================================================================== <?xml version="1.0"?> <!DOCTYPE page [ <!ELEMENT page (title?, content)> <!ELEMENT title (#PCDATA)> <!ELEMENT content (para+)> <!ELEMENT para (#PCDATA)> ]> <page> <title>Hello</title> <content> <para>This page is served by a sub sitemap!</para> </content> </page> 1.1 xml-cocoon2/webapp/sub/docs/simple.xsp Index: simple.xsp =================================================================== <?xml version="1.0" encoding="ISO-8859-1"?> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:xsp-request="http://apache.org/xsp/request/2.0" xmlns:log="http://apache.org/xsp/log/2.0" > <page> <log:logger name="xsp-sample" filename="xsp-sample.log"/> <log:debug>Processing the beginning of the page</log:debug> <title>A Simple XSP Page, served by sub-sitemap</title> <content> <para>Hi there! I'm a simple dynamic page generated by XSP (eXtensible Server Pages).</para> <para>I was requested as the URI: <b><xsp-request:get-uri as="xml"/></b></para> <para>The following list was dynamically generated:</para> <ul> <xsp:logic> <![CDATA[ for (int i=0; i<3; i++) { ]]> <li> Item <xsp:expr>i</xsp:expr> </li> <![CDATA[ } ]]> </xsp:logic> </ul> <xsp:element> <xsp:param name="name"><xsp:expr>"P".toLowerCase()</xsp:expr></xsp:param> <xsp:attribute name="align">left</xsp:attribute> <i> This paragraph was dynamically generated by logic embedded in the page </i> </xsp:element> <para> Request parameter "name" as XML: <xsp-request:get-parameter name="name" default="Not provided" as="xml"/> </para> <para> Request parameter "name" as String: <xsp-request:get-parameter name="name" default="Not provided"/> </para> <xsp-request:get-parameter-values name="name"/> <xsp-request:get-parameter-names/> <para> Header "user-agent" as XML: <xsp-request:get-header name="user-agent" as="xml"/> </para> <para> Header "user-agent" as String: <xsp-request:get-header name="user-agent"/> </para> <xsp-request:get-header-names/> <para>Brought to you by Cocoon2 at <xsp:expr>new Date()</xsp:expr>.</para> </content> <log:debug>Processing the end of the page</log:debug> </page> </xsp:page> 1.3 +21 -106 xml-cocoon2/webapp/sub/stylesheets/error2html.xsl Index: error2html.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/webapp/sub/stylesheets/error2html.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- error2html.xsl 2001/05/23 12:32:22 1.2 +++ error2html.xsl 2001/08/24 01:20:10 1.3 @@ -1,113 +1,28 @@ <?xml version="1.0"?> -<xsl:stylesheet version="1.0" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:error="http://apache.org/cocoon/error/2.0"> - -<xsl:template match="error:notify"> - <html> +<html xmlns:error="http://apache.org/cocoon/error/2.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xsl:version="1.0"> <head> - <title> - <xsl:value-of select="@type"/>:<xsl:value-of select="error:title"/> - </title> + <title>Requested resource is not found</title> </head> <body bgcolor="#ffffff"> - <table border="0" bgcolor="#000000" cellpadding="2" cellspacing="2"> - <tbody> - <tr> - <td bgcolor="#0086b2" colspan="2"> - <font color="#ffffff" face="arial,helvetica,sanserif" size="+2"> - <xsl:value-of select="error:title"/> - </font> - </td> - </tr> - - <tr> - <td bgcolor="#0086b2" valign="top"> - <font color="#ffffff" face="arial,helvetica,sanserif" size="+1"> - <xsl:value-of select="@type"/> - </font> - </td> - <td bgcolor="#ffffff" > - <xsl:apply-templates select="error:message"/> - </td> - </tr> - - <tr> - <td bgcolor="#0086b2" valign="top" colspan="2"> - <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">details</font> - </td> - </tr> - - <tr> - <td bgcolor="#0086b2" valign="top"> - <font face="arial,helvetica,sanserif" color="#ffffff">from</font> - </td> - <td bgcolor="#ffffff"> - <font face="arial,helvetica,sanserif"> - <xsl:value-of select="@sender"/> - </font> - </td> - </tr> - - <tr> - <td bgcolor="#0086b2" valign="top"> - <font face="arial,helvetica,sanserif" color="#ffffff">source</font> - </td> - <td bgcolor="#ffffff"> - <font face="arial,helvetica,sanserif"> - <xsl:value-of select="error:source"/> - </font> - </td> - </tr> - - <xsl:apply-templates select="error:description"/> - - <tr> - <td bgcolor="#0086b2" valign="top" colspan="2"> - <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">extra info</font> - </td> - </tr> - - <xsl:apply-templates select="error:extra"/> - - </tbody> - </table> - </body> - </html> -</xsl:template> - - <xsl:template match="error:description"> - <tr> - <td bgcolor="#0086b2" valign="top"> - <font color="#ffffff" face="arial,helvetica,sanserif">description</font> - </td> - <td bgcolor="#ffffff"> - <font face="arial,helvetica,sanserif"> - <xsl:value-of select="."/> - </font> - </td> - </tr> - </xsl:template> - - <xsl:template match="error:message"> - <font face="arial,helvetica,sanserif"> - <xsl:value-of select="."/> - </font> - </xsl:template> - - <xsl:template match="error:extra"> - <tr> - <td bgcolor="#0086b2" valign="top"> - <font color="#ffffff" face="arial,helvetica,sanserif"> - <xsl:value-of select="@description"/> - </font> - </td> - <td bgcolor="#ffffff"> + <p> + <font face="Verdana" size="+2">Requested resource is not found</font> + </p> + <p> + <font face="Verdana"> + Error occured during request processing: + <b><xsl:value-of select="error:notify/error:message"/></b> + </font> + </p> + <br/> + <font face="Verdana" size="-1">The corresponding exception stacktrace:</font> <pre> - <xsl:value-of select="."/> + <xsl:value-of select="translate(error:notify/error:extra[2],' ',' ')"/> </pre> - </td> - </tr> - </xsl:template> -</xsl:stylesheet> + <font face="Verdana" size="-2"> + Brought to you by <a href="http://xml.apache.org/cocoon2/">@docname@</a> in no time! + </font> + </body> +</html> 1.1 xml-cocoon2/webapp/sub/stylesheets/simple-samples2html.xsl Index: simple-samples2html.xsl =================================================================== <?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"> <xsl:template match="/"> <html> <head> <title>Apache Cocoon 2.0b2-dev</title> </head> <body bgcolor="#ffffff" link="#0086b2" vlink="#00698c" alink="#743e75"> <p align="center"><font size="+0" face="arial,helvetica,sanserif" color="#000000">The Apache Software Foundation is proud to present...</font></p> <p align="center"><img border="0" src="../images/cocoon.gif"/></p> <p align="center"><font size="+0" face="arial,helvetica,sanserif" color="#000000"><b>version 2.0b2-dev</b></font></p> <xsl:apply-templates/> <p align="center"> <font size="-1"> Copyright © 1999-2001 <a href="http://www.apache.org">The Apache Software Foundation</a>.<br/> All rights reserved. </font> </p> </body> </html> </xsl:template> <xsl:template match="samples"> <xsl:variable name="t-size" select="count(group)"/> <xsl:variable name="half" select="round($t-size div 2)"/> <table width="100%"> <tr> <td valign="top"> <xsl:for-each select="group"> <xsl:variable name="here" select="position()"/> <xsl:choose> <xsl:when test="../group[$here<=$half]"> <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" width="97%" align="center"> <tr> <td bgcolor="#0086b2" width="100%" align="left"> <font size="+1" face="arial,helvetica,sanserif" color="#ffffff"><xsl:value-of select="@name"/></font> </td> </tr> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center"> <xsl:apply-templates/> </table> </td> </tr> </table> <br/> </xsl:when> <xsl:otherwise></xsl:otherwise> </xsl:choose> </xsl:for-each> </td> <td valign="top"> <xsl:for-each select="group"> <!-- [position()<=$half] --> <xsl:variable name="here" select="position()"/> <xsl:choose> <xsl:when test="../group[$here>$half]"> <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" width="97%" align="center"> <tr> <td bgcolor="#0086b2" width="100%" align="left"> <font size="+1" face="arial,helvetica,sanserif" color="#ffffff"><xsl:value-of select="@name"/></font> </td> </tr> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center"> <xsl:apply-templates/> </table> </td> </tr> </table> <br/> </xsl:when> <xsl:otherwise></xsl:otherwise> </xsl:choose> </xsl:for-each> </td> </tr> </table> </xsl:template> <xsl:template match="sample"> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <font size="+0" face="arial,helvetica,sanserif" color="#000000"> <a href="{@href}"><xsl:value-of select="@name"/></a><xsl:text> - </xsl:text> <xsl:value-of select="."/> </font> </td> </tr> </xsl:template> </xsl:stylesheet> ---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]