You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2004/02/07 16:13:26 UTC
cvs commit: cocoon-2.1/src/webapp/samples/aggregation/stylesheets news.xsl
joerg 2004/02/07 07:13:26
Modified: src/webapp/samples/aggregation sitemap.xmap
src/webapp/samples/aggregation/stylesheets news.xsl
Added: src/webapp/samples/aggregation aggregate.xml
Removed: src/webapp/samples/aggregation aggregate.xsp
Log:
fixing bug 26749: flexible aggregation sample:
It has never really worked as the XSP created the wrong elements. Now we had issues with Xalan/XSTLC/default namespace (it worked indeed with XSLTC). As this is not the issue we want to show with the sample I simplified it massively: XML instead of XSP, no namespace handling.
Revision Changes Path
1.3 +8 -8 cocoon-2.1/src/webapp/samples/aggregation/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/aggregation/sitemap.xmap,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sitemap.xmap 16 Aug 2003 01:44:12 -0000 1.2
+++ sitemap.xmap 7 Feb 2004 15:13:26 -0000 1.3
@@ -63,7 +63,7 @@
</map:match>
<map:match pattern="aggregate">
- <map:aggregate element="page" ns="http://foo.bar.com/myspace">
+ <map:aggregate element="page">
<!--+
| Aggregation is a very powerful concept that allows a document
| be generated from several other documents. Strictly speaking,
@@ -90,14 +90,14 @@
| Thus, the parts refer to the pipeline fragments above.
|
| The optional element attribute places the content in a new root
- | element named as specified, using the namespace provided by the
+ | element named as specified, using the namespace provided by an
| optional ns attribute.
|
| Please see docs for further explanations.
+-->
- <map:part element="news" ns="http://foo.bar.com/slashdot" src="cocoon:/slashdot"/>
- <map:part element="news" ns="http://foo.bar.com/moreover" src="cocoon:/moreover"/>
- <map:part element="news" ns="http://foo.bar.com/xmlhack" src="cocoon:/xmlhack"/>
+ <map:part src="cocoon:/slashdot" element="slashdot"/>
+ <map:part src="cocoon:/moreover" element="moreover"/>
+ <map:part src="cocoon:/xmlhack" element="xmlhack"/>
</map:aggregate>
<map:transform src="stylesheets/news.xsl"/>
<map:serialize/>
@@ -105,9 +105,9 @@
<!-- Aggregation using the Cocoon Include transformer -->
<map:match pattern="aggregate2">
- <map:generate src="aggregate.xsp" type="serverpages"/>
+ <map:generate src="aggregate.xml"/>
<map:transform type="cinclude"/>
- <map:transform src="stylesheets/news.xsl"/>
+ <map:transform type="xsltc" src="stylesheets/news.xsl"/>
<map:serialize/>
</map:match>
1.1 cocoon-2.1/src/webapp/samples/aggregation/aggregate.xml
Index: aggregate.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- CVS $Id: aggregate.xml,v 1.1 2004/02/07 15:13:26 joerg Exp $ -->
<page xmlns:cinclude="http://apache.org/cocoon/include/1.0">
<cinclude:include src="cocoon:/slashdot"/>
<cinclude:include src="cocoon:/moreover"/>
<cinclude:include src="cocoon:/xmlhack"/>
</page>
1.2 +7 -16 cocoon-2.1/src/webapp/samples/aggregation/stylesheets/news.xsl
Index: news.xsl
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/aggregation/stylesheets/news.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- news.xsl 26 Mar 2003 21:21:43 -0000 1.1
+++ news.xsl 7 Feb 2004 15:13:26 -0000 1.2
@@ -1,13 +1,9 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ns0="http://foo.bar.com/myspace"
- xmlns:ns1="http://foo.bar.com/slashdot"
- xmlns:ns2="http://foo.bar.com/moreover"
- xmlns:ns3="http://foo.bar.com/xmlhack">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Match The Root Node -->
- <xsl:template match="ns0:page">
+ <xsl:template match="page">
<html>
<body>
<xsl:apply-templates/>
@@ -15,16 +11,11 @@
</html>
</xsl:template>
- <xsl:template match="ns1:news">
- <xsl:apply-templates select="ns1:HTML/ns1:BODY/*"/>
- </xsl:template>
-
- <xsl:template match="ns2:news">
- <xsl:apply-templates select="ns2:HTML/ns2:BODY/*"/>
- </xsl:template>
-
- <xsl:template match="ns3:news">
- <xsl:apply-templates select="ns3:html/ns3:body/*"/>
+ <xsl:template match="slashdot | moreover | xmlhack">
+ <xsl:variable name="ABC" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
+ <xsl:variable name="abc" select="'abcdefghijklmnopqrstuvwxyz'"/>
+ <xsl:apply-templates select="*[translate(local-name(), $ABC, $abc) = 'html']/
+ *[translate(local-name(), $ABC, $abc) = 'body']/*"/>
</xsl:template>
<xsl:template match="@*|*|text()" priority="-1">