Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML to WML

 
Reeti Saha
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
While I'm trying to generate wml from a XML and XSL file using Xalan then the wml file that it is creating is not working on a wap enabled browser.
The wml file doesn't contain the line:
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD
/wml_1.1.xml">
I think there is some problem in my xsl file.
Whether anyone can provide me a sample xsl file for doing the same.
It's urgent.
Regards
Reeti
 
Sham Jowsaki
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi reeti,
There are 2 ways you can rectify this problem.
1. The first one is your .xsl coding should be like below
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="xsl utput">
<xsl:copy>
<xsl:attribute name="method">xml</xsl:attribute>
<xsl:attribute name="doctype-public">-//WAPFORUM//DTD WML 1.1//EN</xsl:attribute>
<xsl:attribute name="doctype-system">http://www.wapforum.org/DTD/wml_1.1.xml
</xsl:attribute>
</xsl:copy>
</xsl:template>
<xsl:template match="page">
<wml>
<card title="{@title}">
<xsl:apply-templates/>
</card>
</wml>
2. second one is you have to embed the DOCTYPE Delcaration in CDATA in your .xsl file.
Pls try it out.
Tks
Jowsaki
 
Reeti Saha
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
I'd tried with CDATA but somehow I cldn't make it work.
I've solved the problem by inserting these lines in my xsl file:
<xsl utput method="xml"
indent="yes"
encoding="UTF-8"
doctype-public="-//WAPFORUM//DTD WML 1.1//EN"
doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"/>
Regards
Reeti Saha
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic