0

<x:transformer/>

asked 2008-09-03 13:34:42 +0800

huubf gravatar image huubf
69 1

Hi List,

I was looking at the following <x:tranformer/> sample : http://www.zkoss.org/doc/devguide/ch12s02s02.html
but i have as yet not found out how the get it working. I think i did not configure it correctly, but i have no clue how to do that. The Transformer resides in zml.jar not? I have this installed.

How do i get it to work?

Regards Huub

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2008-09-06 10:15:50 +0800

huubf gravatar image huubf
69 1

updated 2008-09-06 10:16:31 +0800

Hi i found the answer after studying http://www.zkoss.org/smalltalks/rssxml/

# ZK XML Output

While a ZUML page is requested, ZK parser will use the suffix of this request's URL(e.g. *.zul, *.mil, *.zhtml etc) to choose the right way to generate the response document. And in ZK-2.5.0 we add a new way for parser to handle the request from such client side application which requires a XML over HTTP response. In this demo, this client side application is an RSS reader.


This means that you should add a language-mapping to zk.xml (WEB-INF)
in the example:

<language-mapping>
<language-name>xml</language-name>
<extension>zrss</extension>
</language-mapping>

Also in web.xml this extension should appear

<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.zrss</url-pattern>
</servlet-mapping>

So for the <x:transformer/> to work you can choose any extension for the ZK page as long as it's configured in this way.

Regards, Huub

link publish delete flag offensive edit

answered 2008-09-06 12:32:08 +0800

huubf gravatar image huubf
69 1

But there is something else,

What is the proposed solotion for including an external XML source? Can the native ZUL namespace be included ?

The following does not work.

<?page contentType="text/html;charset=UTF-8"?>
<h:window xmlns:h="http://www.zkoss.org/2005/zk/native">
<h:zscript><![CDATA[
xml="<book><title>ZK - Ajax without the JavaScript Framework</title><for-who>Web application designers and programmers who wish to implement rich Ajax web applications in the simplest way.</for-who><author>Henri Chen and Robbie Cheng</author></book>" />
]]></h:zscript>
<x:transformer xsl="books.xsl" xmlns:x="http://www.zkoss.org/2007/xml">
<h:label value="${xml}"/> || ${xml}
</x:transformer>
</h:window>

Or
<?page contentType="text/html;charset=UTF-8"?>
<window>
<label value="OUTPUT"/>
<include src="books.zxml"/>
<h:label value="Enjoy"/>
</window>


Regards, Huub

link publish delete flag offensive edit

answered 2008-09-12 18:38:20 +0800

huubf gravatar image huubf
69 1

updated 2008-09-12 18:38:58 +0800

...
furthermore, it would be great to support xsl parameters
So i suggest the transformer should at least have three attributes

<x:transformer xslt="http://server/xsl" xml="http//:server/xml" parameters="key=value;key=value" />

I solved our problem by creating a transformer java class of mine own, that works like this
Regards, Huub

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-09-03 13:34:42 +0800

Seen: 162 times

Last updated: Sep 12 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More