Mailing List Archive

SourceTypeAction does not start a transformation
Hello,

I like to transform a XML file with various namespaces into the xdoc
format. The XML file is in the xdoc/sap directory and the
transformation is also in place. My problem now is, that nothing
appears on my screen when I want to have a look at the transformed
file.

The header of the source file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xml-fragment xmlns:rpl="urn:ReceiverDeterminationServiceVi"
xmlns:rn0="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:rn1="urn:com.sap.aii.ib.server.api.types"
xmlns:rn2="java:sap/standard"
xmlns:rn3="urn:com.sap.aii.ibdir.server.api.types">

Now I like to filter based on the type of the message.

The relevant namespace for me is the rn3 namespace so I changed the
default sitemap to look like this:

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:actions>
<map:action logger="sitemap.action.sourcetype" name="sourcetype"
src="org.apache.forrest.sourcetype.SourceTypeAction">

...
<sourcetype name="ddp_si-v1.0">
<!-- <document-element
namespace="urn:com.sap.aii.ibdir.server.api.types"/> -->
<document-element local-name="rn3"/>
</sourcetype>
</map:action>
</map:actions>
<map:selectors default="parameter">
<map:selector logger="sitemap.selector.parameter"
name="parameter" src="org.apache.cocoon.selection.ParameterSelector"
/>
</map:selectors>
</map:components>
<map:resources>
<map:resource name="transform-to-document">
<map:act type="sourcetype" src="{src}">
<map:select type="parameter">
<map:parameter name="parameter-selector-test" value="{sourcetype}" />
<map:when test="ddp_si-v1.0">
<map:generate src="{properties:content.xdocs}{../../1}.xml" />
<map:transform
src="{properties:resources.stylesheets}/rd2document.xsl" />
<map:serialize type="xml-document"/>
</map:when>
...
</map:select>
</map:act>
</map:resource>
</map:resources>
<map:pipelines>
<map:pipeline>
<map:match pattern="old_site/**.html">
<map:select type="exists">
<map:when test="{properties:content}{0}">
<map:read src="{properties:content}{0}" mime-type="text/html"/>
</map:when>
</map:select>
</map:match>
<map:match pattern="**.xml">
<map:call resource="transform-to-document">
<map:parameter name="src" value="{properties:content.xdocs}{1}.xml" />
</map:call>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>

I also added a entry in the site.xml which appears in the menu but
does not work as suspected (just a blank page is produced).

<sap1 label="SAP Example 1" description="SAP Beispiele">
<docs-sap1 label="SAP 1" href="sap/" tab="sap">
<sap-pi-rd label="RD" href="si_ddpandmetadata_composite_a_a.html"
description="Test of How To documents"/>
</docs-sap1>
</sap1>

Hope someone can help.

Regards,
Tobias
Re: SourceTypeAction does not start a transformation [ In reply to ]
On 07/04/2010 15:43, Tobias Neef wrote:
> Hello,
>
> I like to transform a XML file with various namespaces into the xdoc
> format. The XML file is in the xdoc/sap directory and the
> transformation is also in place. My problem now is, that nothing
> appears on my screen when I want to have a look at the transformed
> file.

Can you take a look at the intermediate format document by requesting
the *.xml version of your file. Do you see the expected XDoc?

This will tell you whether the problem is in your transformation from
the source or to the HTML.

Ross

>
> The header of the source file looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xml-fragment xmlns:rpl="urn:ReceiverDeterminationServiceVi"
> xmlns:rn0="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:rn1="urn:com.sap.aii.ib.server.api.types"
> xmlns:rn2="java:sap/standard"
> xmlns:rn3="urn:com.sap.aii.ibdir.server.api.types">
>
> Now I like to filter based on the type of the message.
>
> The relevant namespace for me is the rn3 namespace so I changed the
> default sitemap to look like this:
>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> <map:components>
> <map:actions>
> <map:action logger="sitemap.action.sourcetype" name="sourcetype"
> src="org.apache.forrest.sourcetype.SourceTypeAction">
>
> ...
> <sourcetype name="ddp_si-v1.0">
> <!--<document-element
> namespace="urn:com.sap.aii.ibdir.server.api.types"/> -->
> <document-element local-name="rn3"/>
> </sourcetype>
> </map:action>
> </map:actions>
> <map:selectors default="parameter">
> <map:selector logger="sitemap.selector.parameter"
> name="parameter" src="org.apache.cocoon.selection.ParameterSelector"
> />
> </map:selectors>
> </map:components>
> <map:resources>
> <map:resource name="transform-to-document">
> <map:act type="sourcetype" src="{src}">
> <map:select type="parameter">
> <map:parameter name="parameter-selector-test" value="{sourcetype}" />
> <map:when test="ddp_si-v1.0">
> <map:generate src="{properties:content.xdocs}{../../1}.xml" />
> <map:transform
> src="{properties:resources.stylesheets}/rd2document.xsl" />
> <map:serialize type="xml-document"/>
> </map:when>
> ...
> </map:select>
> </map:act>
> </map:resource>
> </map:resources>
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="old_site/**.html">
> <map:select type="exists">
> <map:when test="{properties:content}{0}">
> <map:read src="{properties:content}{0}" mime-type="text/html"/>
> </map:when>
> </map:select>
> </map:match>
> <map:match pattern="**.xml">
> <map:call resource="transform-to-document">
> <map:parameter name="src" value="{properties:content.xdocs}{1}.xml" />
> </map:call>
> </map:match>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap>
>
> I also added a entry in the site.xml which appears in the menu but
> does not work as suspected (just a blank page is produced).
>
> <sap1 label="SAP Example 1" description="SAP Beispiele">
> <docs-sap1 label="SAP 1" href="sap/" tab="sap">
> <sap-pi-rd label="RD" href="si_ddpandmetadata_composite_a_a.html"
> description="Test of How To documents"/>
> </docs-sap1>
> </sap1>
>
> Hope someone can help.
>
> Regards,
> Tobias
Re: SourceTypeAction does not start a transformation [ In reply to ]
Tobias Neef wrote:
>
> I like to transform a XML file with various namespaces into the xdoc
> format. The XML file is in the xdoc/sap directory and the
> transformation is also in place. My problem now is, that nothing
> appears on my screen when I want to have a look at the transformed
> file.

I don't know if this is relevant, but i did have trouble using
the "namespace" method.

See my comment in
http://issues.apache.org/jira/browse/FOR-1173
"
I did also try using the "namespace" method of SourceTypeAction.
It does detect that properly, but then something further down
the forrest processing gets confused about the namespace.
"

-David
Re: SourceTypeAction does not start a transformation [ In reply to ]
I requested the xml and I got an untransformed version of the file.
According to the mentioned problems with the SourceTypeAction I
changed my config to be based on a wildcard.

...
<map:match pattern="**si_ddpandmetadata_composite_a_a.xml">
<map:generate
src="{properties:content.xdocs}{1}si_ddpandmetadata_composite_a_a.xml"
/>
<map:transform
src="{properties:resources.stylesheets}/rd2document.xsl" />
<map:serialize type="xml"/>
</map:match>
...

Now when I have a look at the xml version I get a transformed version
of the XML but when I request the html version I get nothing.


On Wed, Apr 7, 2010 at 6:34 PM, Ross Gardler <rgardler@apache.org> wrote:
> On 07/04/2010 15:43, Tobias Neef wrote:
>>
>> Hello,
>>
>> I like to transform a XML file with various namespaces into the xdoc
>> format. The XML file is in the xdoc/sap directory and the
>> transformation is also in place. My problem now is, that nothing
>> appears on my screen when I want to have a look at the transformed
>> file.
>
> Can you take a look at the intermediate format document by requesting the
> *.xml version of your file. Do you see the expected XDoc?
>
> This will tell you whether the problem is in your transformation from the
> source or to the HTML.
>
> Ross
>
>>
>> The header of the source file looks like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xml-fragment xmlns:rpl="urn:ReceiverDeterminationServiceVi"
>> xmlns:rn0="http://schemas.xmlsoap.org/soap/encoding/"
>> xmlns:rn1="urn:com.sap.aii.ib.server.api.types"
>> xmlns:rn2="java:sap/standard"
>> xmlns:rn3="urn:com.sap.aii.ibdir.server.api.types">
>>
>> Now I like to filter based on the type of the message.
>>
>> The relevant namespace for me is the rn3 namespace so I changed the
>> default sitemap to look like this:
>>
>> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>>   <map:components>
>>     <map:actions>
>>       <map:action logger="sitemap.action.sourcetype" name="sourcetype"
>> src="org.apache.forrest.sourcetype.SourceTypeAction">
>>
>>  ...
>>         <sourcetype name="ddp_si-v1.0">
>>           <!--<document-element
>> namespace="urn:com.sap.aii.ibdir.server.api.types"/>  -->
>>          <document-element local-name="rn3"/>
>>         </sourcetype>
>>       </map:action>
>>     </map:actions>
>>     <map:selectors default="parameter">
>>       <map:selector logger="sitemap.selector.parameter"
>> name="parameter" src="org.apache.cocoon.selection.ParameterSelector"
>> />
>>     </map:selectors>
>>   </map:components>
>>   <map:resources>
>>     <map:resource name="transform-to-document">
>>       <map:act type="sourcetype" src="{src}">
>>         <map:select type="parameter">
>>           <map:parameter name="parameter-selector-test"
>> value="{sourcetype}" />
>>            <map:when test="ddp_si-v1.0">
>>             <map:generate src="{properties:content.xdocs}{../../1}.xml" />
>>             <map:transform
>> src="{properties:resources.stylesheets}/rd2document.xsl" />
>>             <map:serialize type="xml-document"/>
>>           </map:when>
>> ...
>>         </map:select>
>>       </map:act>
>>     </map:resource>
>>   </map:resources>
>>   <map:pipelines>
>>  <map:pipeline>
>>       <map:match pattern="old_site/**.html">
>>         <map:select type="exists">
>>           <map:when test="{properties:content}{0}">
>>             <map:read src="{properties:content}{0}"
>> mime-type="text/html"/>
>>           </map:when>
>>         </map:select>
>>       </map:match>
>>       <map:match pattern="**.xml">
>>         <map:call resource="transform-to-document">
>>           <map:parameter name="src"
>> value="{properties:content.xdocs}{1}.xml" />
>>         </map:call>
>>       </map:match>
>>     </map:pipeline>
>>   </map:pipelines>
>> </map:sitemap>
>>
>> I also added a entry in the site.xml which appears in the menu but
>> does not work as suspected (just a blank page is produced).
>>
>>   <sap1 label="SAP Example 1" description="SAP Beispiele">
>>     <docs-sap1 label="SAP 1" href="sap/" tab="sap">
>>        <sap-pi-rd label="RD" href="si_ddpandmetadata_composite_a_a.html"
>>         description="Test of How To documents"/>
>>     </docs-sap1>
>>   </sap1>
>>
>> Hope someone can help.
>>
>> Regards,
>> Tobias
>
>