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
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).]
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.