You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Mike Chan <yt...@aajc.hku.hk> on 2000/02/10 02:58:53 UTC

Problem transforming XML into WML with XSL

Hi All,

I would like to transform my XML doc into a WML doc. Because the WML doc
itself is another XML doc, I have to include <?xml version="1.0"> tag
and the <!DOCTYPE ...> tag at the very beginning.  However, this causes
problem when I apply the following XSL stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:template match="/">
      <?xml version="1.0"?>
      <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
      <wml>
 <head>
    <meta http-equiv="Cache-Control" content="no-cache" forua="true" />
 </head>
 <card title="card1" newcontext="false" ordered="false">
    <p>
             <xsl:apply-templates/>
    </p>
 </card>
      </wml>
   </xsl:template>

what should I do to insert another <?xml ...?> tag into the transformed
XML doc?

Many thanks

Mike


Re: Problem transforming XML into WML with XSL

Posted by Clemens Cap <ca...@informatik.uni-rostock.de>.
It's not nice to do it like that but you can produce text with
<xsl:text> type of elements. That did the trick for me in a similar
case.


On Thu, Feb 10, 2000 at 09:58:53AM +0800, Mike Chan wrote:
> Hi All,
> 
> I would like to transform my XML doc into a WML doc. Because the WML doc
> itself is another XML doc, I have to include <?xml version="1.0"> tag
> and the <!DOCTYPE ...> tag at the very beginning.  However, this causes
> problem when I apply the following XSL stylesheet:
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
>    <xsl:template match="/">
>       <?xml version="1.0"?>
>       <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
> "http://www.wapforum.org/DTD/wml_1.1.xml">
>       <wml>
>  <head>
>     <meta http-equiv="Cache-Control" content="no-cache" forua="true" />
>  </head>
>  <card title="card1" newcontext="false" ordered="false">
>     <p>
>              <xsl:apply-templates/>
>     </p>
>  </card>
>       </wml>
>    </xsl:template>
> 
> what should I do to insert another <?xml ...?> tag into the transformed
> XML doc?
> 
> Many thanks
> 
> Mike

-- 
Prof.Dr.Clemens H. CAP      
Dept.of Computer Science    office phone               +49-(0)381-498/3390
University of Rostock       office fax                 +49-(0)381-498/3440
Albert Einstein Strasse 21  mailto:cap@informatik.uni-rostock.de
D-18051 Rostock, Germany    http://wwwtec.informatik.uni-rostock.de/iuk

*** Please read this link  http://www.freepatents.org

Re: Problem transforming XML into WML with XSL

Posted by Assaf Arkin <ar...@exoffice.com>.
The formatter/serializer should create the document declaration for you,
no need to specify it in the stylesheet.

arkin

Mike Chan wrote:
> 
> Hi All,
> 
> I would like to transform my XML doc into a WML doc. Because the WML doc
> itself is another XML doc, I have to include <?xml version="1.0"> tag
> and the <!DOCTYPE ...> tag at the very beginning.  However, this causes
> problem when I apply the following XSL stylesheet:
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
>    <xsl:template match="/">
>       <?xml version="1.0"?>
>       <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
> "http://www.wapforum.org/DTD/wml_1.1.xml">
>       <wml>
>  <head>
>     <meta http-equiv="Cache-Control" content="no-cache" forua="true" />
>  </head>
>  <card title="card1" newcontext="false" ordered="false">
>     <p>
>              <xsl:apply-templates/>
>     </p>
>  </card>
>       </wml>
>    </xsl:template>
> 
> what should I do to insert another <?xml ...?> tag into the transformed
> XML doc?
> 
> Many thanks
> 
> Mike

-- 
----------------------------------------------------------------------
Assaf Arkin                                           www.exoffice.com
CTO, Exoffice Technologies, Inc.                        www.exolab.org

Re: Problem transforming XML into WML with XSL

Posted by Steve Muench <sm...@us.oracle.com>.
Use:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml"
              doctype-public="-//WAPFORUM//DTD WML 1.1//EN"
              doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"
              media-type="right-type-for-wap"/>

   <xsl:template match="/">
      <wml>

        <!-- Etc. -->

      </wml>
   </xsl:template>

    <!-- Etc. -->

</xsl:stylesheet>

If your XSLT Engine supports the <xsl:output>
as per the XSLT 1.0 Recommendation, this should
produce the desired output. I know the Oracle
XSLT engine does, and I'm nearly positive that
Xalan, Saxon, and XT (some parts of <xsl:output>)
do too.

_________________________________________________________
Steve Muench, Consulting Product Manager & XML Evangelist
Business Components for Java Development Team

----- Original Message ----- 
From: "Mike Chan" <yt...@aajc.hku.hk>
To: "xerces-dev" <xe...@xml.apache.org>
Sent: Wednesday, February 09, 2000 5:58 PM
Subject: Problem transforming XML into WML with XSL


| Hi All,
| 
| I would like to transform my XML doc into a WML doc. Because the WML doc
| itself is another XML doc, I have to include <?xml version="1.0"> tag
| and the <!DOCTYPE ...> tag at the very beginning.  However, this causes
| problem when I apply the following XSL stylesheet:
| 
| <?xml version="1.0"?>
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
| 
|    <xsl:template match="/">
|       <?xml version="1.0"?>
|       <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
| "http://www.wapforum.org/DTD/wml_1.1.xml">
|       <wml>
|  <head>
|     <meta http-equiv="Cache-Control" content="no-cache" forua="true" />
|  </head>
|  <card title="card1" newcontext="false" ordered="false">
|     <p>
|              <xsl:apply-templates/>
|     </p>
|  </card>
|       </wml>
|    </xsl:template>
| 
| what should I do to insert another <?xml ...?> tag into the transformed
| XML doc?
| 
| Many thanks
| 
| Mike
| 
|