You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2005/09/22 16:50:26 UTC
[DAISY] Updated: cTwIG - Cocoon Two Idiots Guide - Basic XML/XSL
Transformation
A document has been updated:
http://cocoon.zones.apache.org/daisy/legacydocs/647.html
Document ID: 647
Branch: main
Language: default
Name: cTwIG - Cocoon Two Idiots Guide - Basic XML/XSL Transformation (unchanged)
Document Type: Document (unchanged)
Updated on: 9/22/05 2:50:06 PM
Updated by: Helma van der Linden
A new version has been created, state: publish
Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name: (unchanged)
Size: 5567 bytes (previous version: 5573 bytes)
Content diff:
(12 equal lines skipped)
(<a href="ctwig/sample/transformations/basic01/basic01-01.xml">basic01-01.xml</a>):
</p>
--- <pre>
--- <?xml version="1.0"?>
+++ <pre> <?xml version="1.0"?>
<page>
<title>Basic XML/XSL Transformation Example - BASIC01-01.XML</title>
<greeting>Hello World</greeting>
(4 equal lines skipped)
(<a href="ctwig/sample/transformations/basic01/basic01-01.xsl">basic01-01.xsl</a>):
</p>
--- <pre>
--- <?xml version="1.0"?>
+++ <pre> <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="page">
(22 equal lines skipped)
transforming the above files together you just need to add the following code
into the last "pipeline" section:</p>
--- <pre>
--- <map:match pattern="ctwig/basic01-01.xml">
+++ <pre> <map:match pattern="ctwig/basic01-01.xml">
<map:generate type="file" src="ctwig/basic01-01.xml"/>
<map:transform type="xslt" src="ctwig/basic01-01.xsl"/>
<map:serialize/>
(18 equal lines skipped)
makes things easier by allowing wildcards in the pattern matching argument. If
the above section is replaced with the following:</p>
--- <pre>
--- <map:match pattern="ctwig/*.xml">
+++ <pre> <map:match pattern="ctwig/*.xml">
<map:generate type="file" src="ctwig/{1}.xml"/>
<map:transform type="xslt" src="ctwig/{1}.xsl"/>
<map:serialize/>
(8 equal lines skipped)
<p>This also allows us to do a kind of request re-writing function. Take the
following sitemap construct:</p>
--- <pre>
--- <map:match pattern="ctwig/*.html">
+++ <pre> <map:match pattern="ctwig/*.html">
<map:generate type="file" src="ctwig/{1}.xml"/>
<map:transform type="xslt" src="ctwig/{1}.xsl"/>
<map:serialize/>
(19 equal lines skipped)
transforming them into a source code view. This again is achieved using the
sitemap file with a construct similar to the following:</p>
--- <pre>
--- <map:match pattern="ctwig/*.html">
+++ <pre> <map:match pattern="ctwig/*.html">
<map:generate type="file" src="ctwig/{1}.xml"/>
<map:transform type="xslt" src="ctwig/file2html.xsl"/>
<map:serialize/>
(10 equal lines skipped)
Fields
======
no changes
Links
=====
no changes
Custom Fields
=============
no changes
Collections
===========
no changes