wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes problem of transforming XML to WML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "problem of transforming XML to WML" Watch "problem of transforming XML to WML" New topic
Author

problem of transforming XML to WML

Waldle Cai
Ranch Hand

Joined: Aug 16, 2000
Posts: 34
hi all,
When I tried to use Xalan XSLT to transform a XML file to WML, it gave me something funy. Here is the detail:
command line: java org.apache.xalan.xslt.Process -IN hello.xml -XSL hello.xsl -OUT hello.wml
hello.xml file:
<?xml version="1.0"?>
<doc>Hello</doc>
hello.xsl file:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<![CDATA[
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
]]>
<wml>
<card>
<p>
<xsl:value-of select="doc"/>
</p>
</card>
</wml>
</xsl:template>
</xsl:stylesheet>
hello.wml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml><card><p>Hello</p></card></wml>
The question is why the transformer converts "<!DOCTYPE" to "<!DOCTYPE"?
I have to get it right otherwise my WAP browser will complain.
Thanks and Regards
Waldle
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065

Cannot understand what is wrong with <!DOCTYPE -> <!DOCTYPE conversion. My guess is that transformer simply output your CDATA section. Anyay, if it's not what you want, you can probably use "<xsl:output" element for coding your DOCTYPE declaration:
<xsl:output doctype-public="aString" doctype-system="anotherString"/>

[This message has been edited by Mapraputa Is (edited May 17, 2001).]


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Waldle Cai
Ranch Hand

Joined: Aug 16, 2000
Posts: 34
sorry, i made a typing mistake.
My question was why "<!DOCTYPE" was transformed into "<DOCTYPE", which is not what i want.
But I know the answer now. I have to use <xsl.text disable-output-escaping="yes" to disable the escaping. Only using CDATA is not enough.
Jim Baiter
Ranch Hand

Joined: Jan 05, 2001
Posts: 532
This link has some good detail about XML->WML
http://www.wirelessdevnet.com/channels/wap/training/xslt_wml.html
 
Consider Paul's rocket mass heater.
 
subject: problem of transforming XML to WML
 
Similar Threads
XML to WML
Getting from server to the phone
Nokia simulator doesn't work: bad gateway
OTA download problem
guestbook as an example