You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2003/05/20 14:02:50 UTC
cvs commit: cocoon-2.1/src/webapp/samples/xinclude/content loopinclusion.xml test.xml test2.xml test3.xml test4.xml test5.xml
bruno 2003/05/20 05:02:50
Modified: src/webapp/samples samples.xml
Added: src/webapp/samples/xinclude samples.xml sitemap.xmap
src/webapp/samples/xinclude/content loopinclusion.xml
test.xml test2.xml test3.xml test4.xml test5.xml
Log:
Added xinclude sample
Revision Changes Path
1.18 +5 -1 cocoon-2.1/src/webapp/samples/samples.xml
Index: samples.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/samples.xml,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- samples.xml 8 May 2003 13:42:07 -0000 1.17
+++ samples.xml 20 May 2003 12:02:50 -0000 1.18
@@ -35,6 +35,10 @@
(e.g. DTDs, symbols, character entity sets, images) to local copies through
the use of catalogs.
</sample>
+ <sample name="XInclude" href="xinclude/">
+ XInclude transformer sample. XInclude merges XML documents, or parts of
+ them, into one document.
+ </sample>
</group>
<group name="Web Services and B2B">
1.1 cocoon-2.1/src/webapp/samples/xinclude/samples.xml
Index: samples.xml
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<samples xmlns:xlink="http://www.w3.org/1999/xlink">
<group name="Main examples page.">
<sample name="Back" href="..">to Cocoon examples main page</sample>
</group>
<group name="XInclude Samples">
<sample name="General" href="test.html">Demonstration of various XInclude and XPointer features.</sample>
<sample name="Loop inclusion" href="loopinclusion.html">Example of a loop inclusion. This will show an error page.</sample>
</group>
</samples>
1.1 cocoon-2.1/src/webapp/samples/xinclude/sitemap.xmap
Index: sitemap.xmap
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- CVS $Id: sitemap.xmap,v 1.1 2003/05/20 12:02:50 bruno Exp $ -->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- =========================== Views =================================== -->
<map:views>
<map:view name="content" from-label="content">
<map:serialize type="xml"/>
</map:view>
<map:view name="pretty-content" from-label="data">
<map:transform src="context://stylesheets/system/xml2html.xslt"/>
<map:serialize type="html"/>
</map:view>
<map:view name="links" from-position="last">
<map:serialize type="links"/>
</map:view>
</map:views>
<!-- =========================== Pipelines ================================= -->
<map:pipelines>
<map:pipeline>
<map:match pattern="">
<map:generate src="samples.xml"/>
<map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
<map:parameter name="contextPath" value="{request:contextPath}"/>
</map:transform>
<map:serialize/>
</map:match>
<map:match pattern="test.html">
<map:generate src="content/test.xml"/>
<map:transform type="xinclude"/>
<map:transform type="log">
<map:parameter name="logfile" value="xinclude.txt"/>
</map:transform>
<map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
<map:parameter name="contextPath" value="{request:contextPath}"/>
<map:parameter name="servletPath" value="{request:servletPath}"/>
<map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
<map:parameter name="file" value="content/test.xml"/>
<map:parameter name="remove" value="{0}"/>
</map:transform>
<map:serialize/>
</map:match>
<map:match pattern="loopinclusion.html">
<map:generate src="content/loopinclusion.xml"/>
<map:transform type="xinclude"/>
<map:serialize/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
1.1 cocoon-2.1/src/webapp/samples/xinclude/content/loopinclusion.xml
Index: loopinclusion.xml
===================================================================
<?xml version="1.0"?>
<page xmlns:xi="http://www.w3.org/2001/XInclude">
<title>XInclude loop inclusion test</title>
<content>
<xi:include href=""/>
</content>
</page>
1.1 cocoon-2.1/src/webapp/samples/xinclude/content/test.xml
Index: test.xml
===================================================================
<?xml version="1.0"?>
<page xmlns:xi="http://www.w3.org/2001/XInclude">
<title>XInclude demo</title>
<content>
<para><b><![CDATA[<xi:include href="test3.xml"/>]]></b></para>
<xi:include href="test3.xml"/>
<hr/>
<para><b><![CDATA[<xi:include href="test2.xml#xpointer(/page/content/para[2])"/>]]></b></para>
<xi:include href="test2.xml#xpointer(/page/content/para[2])"/>
<hr/>
<para><b><![CDATA[<xi:include href="test2.xml#xmlns(my=http://localhost/my)xpointer(/page/content/my:abc/*)"/>]]></b></para>
<xi:include href="test2.xml#xmlns(my=http://localhost/my)xpointer(/page/content/my:abc/*)"/>
<hr/>
<para><b>Inclusion with an invalid xpointer expression, will cause fallback
element content to be inserted:</b></para>
<para><b><![CDATA[<xi:include href="test2.xml#xpointer(">]]></b></para>
<xi:include href="test2.xml#xpointer(">
<a>
<b>
Any random content inside the xi:include element will be ignored.
</b>
</a>
<xi:fallback>
An error occured! This is the content of the fallback element you're seeing.
</xi:fallback>
And here's some more text you shouldn't see.
</xi:include>
<hr/>
<para><b><![CDATA[
<xi:include href="#xmlns(xi=http://www.w3.org/2001/XInclude)
xpointer(/page/content/xi:include[1])"/>
]]></b></para>
<xi:include href="#xmlns(xi=http://www.w3.org/2001/XInclude)
xpointer(/page/content/xi:include[1])"/>
<hr/>
<para><b>This sample demonstrates the recursive inclusion: here file4.xml
is included, which in itself includes file5.xml:</b></para>
<para><b><![CDATA[<xi:include href="test4.xml"/>]]></b></para>
<xi:include href="test4.xml"/>
<hr/>
<para><b>This example shows how you can put multiple xpointer expressions
one after the other. If one doesn't return a result, it is skipped and
the next one is evaluated, until one is found that returns a
result.</b></para>
<para><b><![CDATA[<xi:include href="test2.xml#xpointer(/x) xpointer(/y) xpointer(/z) xpointer(/page/content/para[2])"/>]]></b></para>
<xi:include href="test2.xml#xpointer(/x) xpointer(/y) xpointer(/z) xpointer(/page/content/para[2])"/>
</content>
</page>
1.1 cocoon-2.1/src/webapp/samples/xinclude/content/test2.xml
Index: test2.xml
===================================================================
<?xml version="1.0"?>
<page xmlns:my="http://localhost/my">
<content>
<para>This is paragraph 1 from test2.xml</para>
<para>This is paragraph 2 from test2.xml</para>
<my:abc>
<para>This is paragraph 3 from test2.xml (inside my:abc element)</para>
</my:abc>
</content>
</page>
1.1 cocoon-2.1/src/webapp/samples/xinclude/content/test3.xml
Index: test3.xml
===================================================================
<para>This is the content of the test3.xml file.</para>
1.1 cocoon-2.1/src/webapp/samples/xinclude/content/test4.xml
Index: test4.xml
===================================================================
<?xml version="1.0"?>
<para xmlns:xi="http://www.w3.org/2001/XInclude">
This is content in test4.xml, will do a include of test5.xml here:
<xi:include href="test5.xml#xpointer(/para/node^(^))"/>
</para>
1.1 cocoon-2.1/src/webapp/samples/xinclude/content/test5.xml
Index: test5.xml
===================================================================
<?xml version="1.0"?>
<para>
This is the content of test5.xml
</para>