Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 3rd, 2008, 05:39 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLTProcessor and Blackberry browser

Hi, is there a way to make this code render on a blackberry browser?

Code:
<script>
if(window.ActiveXObject){
// IE

// Load XML
xml = new ActiveXObject("MSXML2.DOMDocument");
xml.async = false
xml.load("ONXX.xml")

// Load XSL
xsl = new ActiveXObject("MSXML2.DOMDocument");
xsl.async = false
xsl.load("displayquote.xsl")


// Transform
document.getElementById("example").innerHTML=xml.transformNode(xsl);
}else if(document.implementation && document.implementation.createDocument){
// Mozilla

var xsltProcessor = new XSLTProcessor();

// load the xslt file
var myXMLHTTPRequest = new XMLHttpRequest();
myXMLHTTPRequest.open("GET", "displayquote.xsl", false);
myXMLHTTPRequest.send(null);

// get the XML document
xslStylesheet = myXMLHTTPRequest.respon****ML;
xsltProcessor.importStylesheet(xslStylesheet);

// load the xml file
myXMLHTTPRequest = new XMLHttpRequest();
myXMLHTTPRequest.open("GET", "ONXX.xml", false);
myXMLHTTPRequest.send(null);

var xmlSource = myXMLHTTPRequest.respon****ML;

//transform
 var resultDocument = xsltProcessor.transformToFragment(xmlSource, document);
document.getElementById("example").appendChild(resultDocument);

}else{
// Browser unknown
alert("Browser unknown");
}


</script>
Currently the code looks like it is just skipped by the browser. Thanks!

-K
Reply With Quote
  #2 (permalink)  
Old July 3rd, 2008, 06:24 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I very much doubt the BlackBerry browser has the ability to create COM objects via client-side script.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old July 3rd, 2008, 07:55 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there an equivalent to getting xml to render on the bb browser?
Reply With Quote
  #4 (permalink)  
Old July 4th, 2008, 04:25 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I'm going to hazard a guess and say that you would get a better answer to that question on a Blackberry specific forum than on this one. I believe RIM themselves have a set of developer forums.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #5 (permalink)  
Old September 16th, 2008, 07:47 AM
Registered User
 
Join Date: Sep 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Use any server side program instead of client side like jsp/asp.

Also use transformation technique with xsl and xml to generate html.

Thanks,
Felix Baskar.
Sr Application Development Consultant
Emantras Inc.

Reply With Quote
  #6 (permalink)  
Old September 16th, 2008, 07:52 AM
Registered User
 
Join Date: Sep 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also i tried with servlet its working fine.
Please find the code below ,


  public void doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
        try {
        // get the filename of the XSLT stylesheet
        String xsltName = req.getParameter("xslt");

        if (xsltName == null) {
            throw new ServletException("xslt is a required parameter");
        }

        ServletContext ctx = getServletContext();
        InputStream xmlIn = ctx.getResourceAsStream("/hello.xml");
        InputStream xsltIn = ctx.getResourceAsStream(xsltName);
        //InputStream xsltIn = ctx.getResourceAsStream("/hello.xsl");

            // show how to read from a system identifier and a Reader
            Source xmlSource = new StreamSource(xmlIn);
            Source xsltSource = new StreamSource(xsltIn);

            res.setContentType("text/html");
            Result result = new StreamResult(res.getOutputStream());

            // get the factory
            TransformerFactory transFact = TransformerFactory.newInstance();

            // get a transformer for this particular stylesheet
            Transformer trans = transFact.newTransformer(xsltSource);

            // do the transformation
            trans.transform(xmlSource, result);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new ServletException(ex);
        }
    }
Thanks,

Felix Baskar.
Sr Application Development Consultant
Emantras Inc.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 10:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.