You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Varalakshmi Kollipara <Va...@DigitalInsight.com> on 2004/01/09 23:05:01 UTC
SourceWritingTransformer
Hello everyone can anyone send me some SourceWritingTansformer examples.
Thanks in advance,
Lakshmi.
RE: SourceWritingTransformer
Posted by Lars Huttar <la...@sil.org>.
I assume you have looked at the examples at
cocoon/docs/userdocs/components/transformers/sourcewriting-transformer.html
Here's what we use (under Cocoon 2.1.2).
In the sitemap:
...
<map:view name="source" from-label="source">
<map:transform type="write-source">
<!-- <map:parameter name="serializer" value="text" /> --><!-- unnecessary -->
</map:transform>
<map:transform src="transforms/post-write-source.xsl" />
<map:serialize/>
</map:view>
...
<map:match pattern="*/*/cell/*/s*/*.xsl"> <!-- Stylesheet to generate Row 5 source code -->
<map:generate src="cocoon:/base/{1}/{2}/{3}/s{4}" label="raw" />
<map:transform src="archFrame/s{4}/{3}/{5}.xsl" label="source"> <!-- here -->
<map:parameter name="system" value="{1}" />
</map:transform>
<map:transform src="transforms/source.xsl" label="raw2">
<map:parameter name="system" value="{1}" />
<map:parameter name="state" value="{2}" />
</map:transform>
<map:serialize type="html"/>
</map:match>
So if the parameter ?cocoon-view=source is included on the request URL,
the output of the transform labeled "here" goes to the SourceWritingTransformer;
otherwise it goes to a different transformer (post-write-source.html)
that formats it as human-friendly HTML.
An example of the input to the SourceWritingTransformer:
<pages xmlns:sil="http://www.sil.org/namespace/xsp-query"
xmlns:xsp-request="http://apache.org/xsp/request/2.0" xmlns:xsp="http://apache.org/xsp"
xmlns:source="http://apache.org/cocoon/source/1.0">
<system>Ethnologue</system>
<architect>Gary S</architect>
<date>2003-12-13</date>
<role id="admin">Ethnologue editor</role>
<source:write serializer="xml">
<source:source>context:/mount/gem/enterprise/systems/Ethnologue/admin/index.xsp<source:source>
<source:fragment>
<xsp:page language="java" sil:dummy="" xsp-request:dummy="">
<index-page>
<system>Ethnologue</system>
<role>Ethnologue editor</role>
...
</index-page>
</xsp:page>
</source:fragment>
</source:write>
<source:write serializer="text" xmlns:source="http://apache.org/cocoon/source/1.0">
<source:source>context:/mount/gem/ddl-out-oracle.sql</source:source>
<source:fragment>
<dummy>-- Oracle 9i database schema for Ethnologue
-- Automatically generated from GEM system model
-- Define the tables
CREATE OR REPLACE TABLE Alternate_Dialect_Name (
...
</dummy>
</source:fragment>
</source:write>
...
</pages>
-----Original Message-----
From: Varalakshmi Kollipara
Sent: Friday, January 09, 2004 4:05 PM
To: 'users@cocoon.apache.org'
Subject: SourceWritingTransformer
Hello everyone can anyone send me some SourceWritingTansformer examples.
Thanks in advance,
Lakshmi.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org