File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem of transforming XML to WML

 
Waldle Cai
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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).]
 
Waldle Cai
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 532
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link has some good detail about XML->WML
http://www.wirelessdevnet.com/channels/wap/training/xslt_wml.html
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic