Panicking about XML to WML - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Panicking about XML to WML

Description:

Panicking about XML to WML? Here is some help. Recap. You can use. XML to store the data. XSLT to transform the presentation of the data BUT No.1 ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 9
Provided by: downst
Category:
Tags: wml | xml | panicking

less

Transcript and Presenter's Notes

Title: Panicking about XML to WML


1
Panicking about XML to WML?
  • Here is some help

2
Recap
  • You can use
  • XML to store the data
  • XSLT to transform the presentation of the data
    BUT No.1
  • only if the output platform can process the
    XSLT and the XML file
  • BUT No.2
  • WAP browsers cant handle this processing

3
So how do you process XSLT for WAP?
  • Well since you cant client side process it then
    you must server side process it
  • Easiest method?
  • Use ASP (or Coldfusion)

4
Using ASP
  • Using Microsoft Document Object Model server code
    (DOM) you can execute and instance of an XML
    parser
  • You call an ASP page which calls the DOM
  • This will load the XML
  • Then it will load the XSL
  • The it process the XML through the XSL and
    outputs the file

5
ASP method
  • lt
  • '---Create an instance of the DOM object---
  • Set xml Server.CreateObject("MSXML2.DOMDocument"
    )
  • '---Let it run synchronously---
  • xml.async false
  • '---Load the XML document---
  • xml.load (Server.MapPath("XMLCourse.xml"))
  • Set xsl Server.CreateObject("MSXML2.DOMDocument"
    )
  • xsl.async false
  • '---Load the XSLT stylesheet---
  • xsl.load (Server.MapPath("WML.xsl"))
  • '---Set the MIME type---
  • Response.ContentType "text/vnd.wap.wml"
  • '---Send the WML prologue---
  • Response.Write lt?xml version'1.0'?gt
    Response.Write "lt!DOCTYPE wml PUBLIC
    ""-//WAPFORUM//DTD " _ "WML 1.1//EN""
    ""http//www.wapforum.org/DTD/wml_1.1.xml""gt"
  • '---Performs the transformation---
  • Response.write (xml.transformNode(xsl))
  • gt

6
Previous example taken from
  • http//www.wirelessdevnet.com/channels/wap/trainin
    g/xslt_wml.html

7
Using Coldfusion
  • lt!--- You want to work with the Company.xml file,
    ---gt
  • lt!--- which is in the same folder as this CF
    template ---gt
  • ltCFSET MyXmlFile ExpandPath("Company.xml")gt
  • lt!--- Read XML file into string variable called
    MyXmlCode ---gt
  • ltCFFILE ACTION"READ"
  • FILE"MyXmlFile"
  • VARIABLE"MyXmlCode"gt
  • lt!--- You also need to work with your XSLT
    Stylesheet code ---gt
  • ltCFSET MyStylesheet ExpandPath("TransformCompany
    .xsl")gt
  • lt!--- Read XSLT file into string variable called
    MyXsltCode ---gt
  • ltCFFILE
  • ACTION"READ"
  • FILE"MyStylesheet"
  • VARIABLE"MyXsltCode"gt
  • lt!--- Perform the XSLT Stylesheet transformation
    ---gt
  • ltCFSET TransformedXmlCode XmlTransform(MyXmlCode
    , MyXsltCode)gt

8
Taken from
  • http//www.macromedia.com/devnet/mx/coldfusion/art
    icles/xmlxslt.pdf
Write a Comment
User Comments (0)
About PowerShow.com