Hi Anand, As Derek mentioned, it is unusual to want to write the XML to a file before processing it. If you really want to do this, you can use the SourceWritingTransformer (we have used this successfully). But if you just want to see the XML for the sake of debugging or knowing what's coming down the pipeline, the easiest way is just to let the XML come down the pipeline unprocessed. E.g. change your "test/*/" pattern to:
<map:match pattern="test/*/ ">
<map:aggregate element="page" label="page-content">
<map:part src="cocoon:/test-contents/" />
<map:part src="cocoon:/actions" />
<map:part src="cocoon:/test-meta/{1}" strip-root="true" />
</map:aggregate>
<map:serialize type="xml" />
</map:match>
This will let the XML show up in the browser, and you can save it
to a file.
Another way to do this is to use views. Views will let you "peek"
into a stage of the pipeline without changing the sitemap.
With your "test/*/" pattern:
<map:match pattern="test/*/ ">
<map:aggregate element="page" label="page-content">
<map:part src="cocoon:/test-contents/" />
<map:part src="cocoon:/actions" />
<map:part src="cocoon:/test-meta/{1}" strip-root="true" />
</map:aggregate>
<map:call resource="convertTo-html">
<map:parameter name="action" value="./act" />
</map:call>
</map:match>
you can add this to the <map:views> section of your sitemap:
<map:view name="page-content" from-label="page-content">
<map:serialize type="xml"/>
</map:view>
And then when you access the URL, add a "cocoon-view=" parameter:
http://myhost/cocoon/.../test/foo/ ?cocoon-view=page-content
By the way you may want to remove the spaces within quotes
in your match patterns and resource names. Then the above URL would be
http://myhost/cocoon/.../test/foo/?cocoon-view=page-content
HTH,
Lars
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 06, 2004 12:49 PM
To: [EMAIL PROTECTED]
Subject: Newbie: Generating XML before rendering HTML
Hi,
I have the sitemap.xmap configured as below.
What we are tyring to do is to get data from the database, store it into session and
render it as
HTML.
I would like to know how we can generate a xml file to a local directoy before it
gets rendered to
the brower.
I need this , as I want to understand what is the content of the XML being used , so
that I can
write my . xsl file correctly.
Would appreciate if some one can tell me how to achieve this or throw some pointer to
achieve the
same.
Thanks in advance.
Have a nice day.
Regards,
<map:pipeline>
<map:match pattern="test/*/ ">
<map:aggregate element="page" label="page-content">
<map:part src="cocoon:/test-contents/" />
<map:part src="cocoon:/actions" />
<map:part src="cocoon:/test-meta/{1}" strip-root="true" />
</map:aggregate>
<map:call resource="convertTo-html">
<map:parameter name="action" value="./act" />
</map:call>
</map:match>
<map:match pattern="test-contents/">
<map:generate type="session-attr">
<map:parameter name="attr-name" value="{1}" />
<map:parameter name="root-element" value="content" />
</map:generate>
<map:transform type="paginate" src="cocoon:/test-prefs/pagination">
</map:transform>
<map:serialize type="xml" />
</map:match>
<map:resource name=" convertTo-html ">
<map:transform src="stylesheets/test-framed.xsl">
</map:transform>
<map:call resource="show-page" />
</map:resource>
<map:resource name="show-page">
<map:act type="locale">
<map:transform type="i18n">
<map:parameter name="locale" value="{locale}" />
</map:transform>
</map:act>
<map:transform type="abs" src="abs-config.xml" />
<map:serialize type="xhtml" />
</map:resource>
Confidentiality Notice
The information contained in this electronic message and any attachments to this
message are
intended
for the exclusive use of the addressee(s) and may contain confidential or privileged
information.
If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL
PROTECTED]
immediately
and destroy all copies of this message and any attachments.
<<attachment: winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
