stefano 2002/06/27 11:45:32 Modified: src/scratchpad/webapp/mount/paginator README.txt sitemap.xmap Added: src/scratchpad/webapp/mount/paginator/content list.xml src/scratchpad/webapp/mount/paginator/pagesheets list.pagesheet src/scratchpad/webapp/mount/paginator/stylesheets list2html.xsl pagedlist2html.xsl Removed: src/scratchpad/webapp/mount/paginator document.xml src/scratchpad/webapp/mount/paginator/pagesheets images.xml images2.xml Log: a paginator sample to show how it works (Diana, I blasted yours a little, hope you don't mind) Revision Changes Path 1.2 +1 -1 xml-cocoon2/src/scratchpad/webapp/mount/paginator/README.txt Index: README.txt =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/paginator/README.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- README.txt 27 Jun 2002 15:56:53 -0000 1.1 +++ README.txt 27 Jun 2002 18:45:31 -0000 1.2 @@ -11,6 +11,6 @@ During the build process, the necessary configuration details for the PaginatorTransformer component are copied to cocoon.xconf of cocoon.war. This means that you don't need to manually configure cocoon.xconf. To get going, access: - http://localhost:8080/cocoon/mount/paginator/page(1) + http://localhost:8080/cocoon/mount/paginator/list(1) Have fun! 1.2 +38 -40 xml-cocoon2/src/scratchpad/webapp/mount/paginator/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/paginator/sitemap.xmap,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sitemap.xmap 27 Jun 2002 15:56:53 -0000 1.1 +++ sitemap.xmap 27 Jun 2002 18:45:31 -0000 1.2 @@ -1,43 +1,41 @@ <?xml version="1.0"?> - <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> - <map:components> - <map:generators default="file"/> - <map:serializers default="html"/> - <map:transformers default="xslt"> - <map:transformer - name="paginator" - src="org.apache.cocoon.transformation.pagination.Paginator" - logger="sitemap.transformer.paginator" /> - </map:transformers> - <map:readers default="resource"/> - <map:matchers default="wildcard"/> - <map:selectors default="browser"/> - </map:components> - - <map:pipelines> - - <map:pipeline> - - <map:match pattern=""> - <map:redirect-to uri="page(1)" /> - </map:match> - - <map:match pattern="page(*)"> - <map:generate src="document.xml"/> - <map:transform src="pagesheets/images.xml" type="paginator"> - <map:parameter name="page" value="{1}"/> - </map:transform> - <map:serialize type="xml"/> - </map:match> - - <map:handle-errors> - <map:transform src="context://stylesheets/system/error2html.xsl"/> - <map:serialize status-code="500"/> - </map:handle-errors> - - </map:pipeline> - </map:pipelines> -</map:sitemap> -<!-- end of file --> + <map:components> + <map:generators default="file"/> + <map:transformers default="xslt"> + <map:transformer name="paginate" src="org.apache.cocoon.transformation.pagination.Paginator"/> + </map:transformers> + <map:readers default="resource"/> + <map:serializers default="html"/> + <map:matchers default="wildcard"/> + <map:selectors default="browser"/> + </map:components> + + <map:pipelines> + <map:pipeline> + + <map:match pattern=""> + <map:redirect-to uri="list(1)"/> + </map:match> + + <map:match pattern="list"> + <map:generate src="content/list.xml"/> + <map:transform src="stylesheets/list2html.xsl"/> + <map:serialize type="html"/> + </map:match> + + <map:match pattern="list(*)"> + <map:generate src="content/list.xml"/> + <map:transform type="paginate" src="pagesheets/list.pagesheet"> + <map:parameter name="page" value="{1}"/> + </map:transform> + <map:transform src="stylesheets/pagedlist2html.xsl"/> + <map:serialize type="html"/> + </map:match> + + </map:pipeline> + + </map:pipelines> + +</map:sitemap> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/paginator/content/list.xml Index: list.xml =================================================================== <list> <item>This is item 1</item> <item>This is item 2</item> <item>This is item 3</item> <item>This is item 4</item> <item>This is item 5</item> <item>This is item 6</item> <item>This is item 7</item> <item>This is item 8</item> <item>This is item 9</item> </list> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/paginator/pagesheets/list.pagesheet Index: list.pagesheet =================================================================== <?xml version="1.0"?> <pagesheet xmlns="http://apache.org/cocoon/paginate/1.0"> <rules> <count type="element" name="item" num="4"/> <link type="unit" num="1"/> </rules> </pagesheet> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/paginator/stylesheets/list2html.xsl Index: list2html.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>Complete List</title> </head> <body bgcolor="white" alink="red" link="blue" vlink="blue"> <h3>Complete List</h3> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="list"> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="item"> <li><xsl:apply-templates/></li> </xsl:template> </xsl:stylesheet> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/paginator/stylesheets/pagedlist2html.xsl Index: pagedlist2html.xsl =================================================================== <?xml version="1.0"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY laquo "«" > <!ENTITY raquo "»" > <!ENTITY nbsp " " > ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:page="http://apache.org/cocoon/paginate/1.0" > <xsl:template match="/"> <html> <head> <title>Paged List</title> </head> <body bgcolor="white" alink="red" link="blue" vlink="blue"> <h3>Paged List</h3> <xsl:apply-templates/> <a href="{//page:page/@clean-uri}">single page version</a> </body> </html> </xsl:template> <xsl:template match="list"> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="item"> <li><xsl:apply-templates/></li> </xsl:template> <xsl:template match="page:page"> <xsl:if test="@total > 1"> <!-- page navigation table --> <table border="0"> <tr> <!-- td prev --> <td align="right"> <xsl:if test="page:link[@type='prev']"> <xsl:variable name="previous" select="@current - 1"/> <a href="{page:link[@page = $previous]/@uri}">« prev</a> </xsl:if> </td> <!-- td current --> <td align="center"> [page <xsl:value-of select="@current"/> of <xsl:value-of select="@total"/>] </td> <!-- td next --> <td align="left"> <xsl:if test="page:link[@type='next']"> <xsl:variable name="next" select="@current + 1"/> <a href="{page:link[@page = $next]/@uri}">next »</a> </xsl:if> </td> </tr> </table> </xsl:if> </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]