XMLDocument and xsl ??!! How to do that ??

Hi all,
i've an XMLDocument (java object) and a xsl file (on disk). I would like to generate HTML from that (from a servlet actually)...is it possible ?? Can u show me a piece of code ?
Thanks a lot!!
Javamad.

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Example extends HttpServlet
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
res.setContentType("text/html");
PrintWriter out=res.getWriter();
Runtime r = Runtime.getRuntime();
Process p=null;
try
p=r.exec("c:\\test.bat");
catch(Exception e)
out.println("Error from execution" + e.toString());
test.bat file:-
(java -classpath c:\lotusxsl-j_2_0_1\bin\xerces.jar;c:\lotusxsl-j_2_0_1\bin\lotusxsl.jar;c:\lotusxsl-j_2_0_1\bin\xalan.jar;c:\lotusxsl-j_2_0_1\bin\xalanservlet.jar; com.lotus.xsl.Process -in file1.xml -xsl file2.xsl -out file3.html)
With Regards

Similar Messages

  • Solaris 10, Apachee and JSP - how to make that work?

    Hi.
    I'm using Solaris 10, it has Apachee server, and I would like to develop on JSP.
    What do I need that Apachee will support JSP and how to install it?
    Thank you.

    if you very much prefer 'Apache' then you can get this done by downloading tomcat.
    but, why go through the trouble, when web server 7 - which supports solaris 10 and can also run java web applications with lot more bells and whistles. if you have not , please check the what'z new features
    http://docsview.sfbay/app/docs/doc/819-2614/6n4t239c4?a=view

  • Converting XML and XSL into HTML

    Hello!
    I'm designing a servlet class that merges an xml file and xsl file into html that will be sent to the client. But I don't understand how the (sparsely documented) javax.xml.transform.dom package works. An exception is generated for a missing "version" tag, when I've included one that has worked on client-side xml/xsl pages before. If it matters, I'm using Apache Tomcat/JDK 1.4.
    Here's the code:package mypackage.servlet.xml;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class XML2HTMLServlet extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response)
          throws IOException, ServletException {
              response.setContentType("text/html");
              PrintWriter writer = response.getWriter();
              try {
                   openFile("D:/Webdev/xml2html/data.xml", "D:/Webdev/xml2html/style.xsl", writer);
              } catch (Exception e) {
                   e.printStackTrace(writer);
         private void openFile(String xmlPath, String xslPath, PrintWriter writer)
          throws IOException, ParserConfigurationException, SAXException,
          TransformerConfigurationException, TransformerException {
              File xmlFile = new File(xmlPath);
              File xslFile = new File(xslPath);
              TransformerFactory tFact = TransformerFactory.newInstance();
              DocumentBuilderFactory dbFact = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = dbFact.newDocumentBuilder();
              Document xmlDoc = builder.parse(xmlFile);
              Document xslDoc = builder.parse(xslFile);
              Node xmlDocNode = (Node)xmlDoc;
              Node xslDocNode = (Node)xslDoc;
              DOMSource xmlSrc = new DOMSource(xmlDocNode);
              DOMSource xslSrc = new DOMSource(xslDocNode);
              DOMResult htmlResult = new DOMResult();
              Transformer transformer = tFact.newTransformer(xslSrc);  // the exception occurs here!
    When it runs, it complains:
    javax.xml.transform.TransformerConfigurationException:
    javax.xml.transform.TransformerConfigurationException:
    javax.xml.transform.TransformerException:
    javax.xml.transform.TransformerException: stylesheet requires attribute: version at
    org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:767) at
    mypackage.servlet.xml.XML2HTMLServlet.openFile(XML2HTMLServlet.java:49) at
    ...etc...etc...
    data.xml contains:
    <?xml version="1.0"?>
    <document type="lecture">
         <title>Test Data</title>
         <section>
              <name>A New Section</name>
         </section>
    </document>
    style.xsl contains:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
         <html>
              <head>
                   <title><xsl:value-of select="document/title"/></title>
              </head>
              <body>
                   <xsl:apply-templates select="document/section"/>
              </body>
         </html>
    </xsl:template>
    <xsl:template match="section">
         <div><i>Section</i><br/><xsl:value-of select="name"/></div>
    </xsl:template>
    </xsl:stylesheet>I'm not sure the method calls above are what I want, so here's the client-side equivalent in Internet Explorer 5.0:
    function createStyledXMLDocument(xmlUrl, xslUrl) {
         var xmlDocument = new ActiveXObject("Microsoft.XMLDOM");
         xmlDocument.load(xmlUrl);
         var xslDocument = new ActiveXObject("Microsoft.XMLDOM");
         xslDocument.load(xslUrl);
         return xmlDocument.transformNode(xslDocument);
    }Any help would be greatly appreciated.

    Hi!
    I found the immediate answer with
    dbFact.setNamespaceAware(true);As for parser, I'm just using the default JDK install. But I'd like to hear more on Xalan. Is it independent open source? How does Xalan compare to whatever is default in JDK?
    Thanks

  • I cannot seem to use yahoo games....does anyone know why and/or how to fix it?

    I cannot seem to use yahoo games......does anyone know why and/or how to fix that?

    Best to post in the iMovie forum where those experts are.

  • Can any one tell me how can I move to a different folder pictures, that I've cloned, without them staying aggregated? They all come together to the other folder and I don't want that- thanks

    Can any one tell me how can I move to a different folder pictures, that I've cloned, without them staying aggregated? They all come together to the other folder and I don't want that… thanks

    There's more to it than that.
    Folders in Aperture do not hold Images.  They hold Projects and Albums.  You cannot put an Image in a Folder without putting it in a Project or an Album inside that Folder.
    The relationship between Projects and Images is special:  every Image must in a Project, and can be in only one Project.
    Images can be in as many Albums you want.  Putting an Image in an Album does not move it from the Project that holds it.
    You can make as many Versions from a Master as you want.
    What you want to do may appear simple to you, but it still much adhere to how Aperture works.  I still can't tell exactly what you are trying to do (specifically: Images don't live in Folders; moving an Image from a Folder is non-sensical).
    It can be very confusing (and frustrating) to get going with Aperture -- but it does work, and can be enormously helpful.  If you haven't, take a look at the video tutorials on Apple's Aperture support site.
    I feel as though I haven't helped you much -- but we need to be using the same names for interface items in order to get anything done -- and my sense is that you still haven't learned the names of the parts.

  • I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have reduced functionality what it this about and how do I get my product back

    I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have reduced functionality what it this about and how do I get my product back

    Hi there
    I have version 5.7 and every time I opened it I was told that updates are available and to click on the icon to access these.  Instead it just took me to the
    adobe page with nowhere visible to update.  I then  sought to download lightroom cc and this is when I could not access the 'develop' section due to reduced
    functionality  It was apparent that my photos had been put in cc but no way to access them unless I wanted to subscribe. 
    I have since remedied the problem as  my original lightroom 5.7 icon is still available on the desktop and have gone back to that.  I do feel that this is a bit
    of a rip off and an unnecessary waste of my time though.
    Thank you for your prompt reply by the way.
    Carlo
    Message Received: May 04 2015, 04:52 PM
    From: "dj_paige" <[email protected]>
    To: "Carlo Bragagnolo" <[email protected]>
    Cc:
    Subject:  I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have
    reduced functionality what it this about and how do I get my product back
    dj_paige  created the discussion
    "I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have reduced functionality what it
    this about and how do I get my product back"
    To view the discussion, visit: https://forums.adobe.com/message/7510559#7510559
    >

  • I have 5 html pages that share a common header, footer, and sidebar. how do i use my nav bar to change the content of the body without duplicating a lot of code?

    i have 5 html pages that share a common header, footer, and sidebar. how do i use my nav bar to change the content of the body without duplicating a lot of code? thank you!

    i inherited the website. It’s for a non-profit and is not very
    sophisticated, and neither am I in webdesign. It currently has multiple
    pages that are identical except for that body section, so whenever i change
    the navigation (in the sidebar) I have to update every html page.  I want
    to have one basic page, and just call in the different body content based
    on the link the user selects from the nav bar. How can i do that using a
    script? i am using Dreamweaver.
    ~ in love and light ~
    Jeannie
    On Sat, Feb 7, 2015 at 4:07 AM, Ben Pleysier <[email protected]>

  • My transparency does not work on my iPhone and I was wondering how I fix that? It worked when I first downloaded ios7 but not now.

    My transparency does not work on my iPhone and I was wondering how I fix that? It worked when I first downloaded ios7 but not now.

    Hello wilsontot_too,
    Thank you for the details of the issue you are experiencing on your iPhone.  It sounds like you are not noticing transparency on your iPhone.  It may be that you have "Increase Contrast" turned on in your iPhone settings.
    I recommend verifying that Increase Contrast is turned off in Settings>General>Accessibility.
    iPhone User Guide - Large, bold, and high-contrast text
    http://help.apple.com/iphone/7/#/iph73b89c6
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • HT1386 I have an older iPhone (3gs) and need to upgrade to a newer phone (4S).  I need to get my NOTES, CALENDAR, CONTACTS, PICTURES, etc backed up on iTunes so I can get that data loaded onto the new phone.  But not sure how to do that.

    I have an older iPhone (3gs) and need to upgrade to a newer phone (4S).  I need to get my NOTES, CALENDAR, CONTACTS, PICTURES, etc backed up on iTunes so I can get that data loaded onto the new phone.  But not sure how to do that.  When I open iTunes it has a button that say "Back Up iPhone", but I'm not sure what that does.  When I go into the sync options it say I have another user account and asks me if I want to merge of replace. I'm assuming it's trying to tell me I have an older iTunes Library, but don't know that.  Geez, maybe people over 60 shouldn't have iPhones, iTunes just bafles me.

    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • HT201407 hi..I cant activate my Iphone 5. I bought this from someone who cant remember her apple password and even the email address that she used to set up the account.What am I gonna do now....How can I activate my Iphone. what are my options...pls help

    hi..I cant activate my Iphone 5. I bought this from someone who cant remember her apple password and even the email address that she used to set up the account.What am I gonna do now....How can I activate my Iphone. what are my options...pls help me.thank you

    Activation Lock in iOS 7  >  http://support.apple.com/kb/HT5818
    hannibalfromlemery wrote:
    .I cant activate my Iphone 5. I bought this from someone
    The Apple ID and Password that was Originally used to Activate the iDevice is required.
    If you cannot get this information from the seller
    Removing a device from a previous owner’s account
    You need to return the Device for a refund, as you will not be able to re-activate it.

  • I am trying to connect a second monitor on my system so that I have one to work on and the other that I am projecting. Any ideas on how to do that?

    I am trying to connect a second monitor on my system so that I have one to work on and the other that I am projecting. Any ideas on how to do that?

    connect, then in SystemPreferences/Displays you can set the two as you want.

  • I am trying to add a new credit card and it keeps telling me that I have to enter a valid security code...I have tried 2 different cards and it is doing the same thing. How do I get past this?

    I guess it has been a year since I last purchased something on I-tunes and my account is saying that they couldn't authorize my card for some of my purchases.  I am trying to add a new credit card to clear this up and it keeps saying that I have to enter a valid security code.  I have tried 2 different cards and I get the same thing.  I have also added an I-tunes gift card and that isn't clearing up the money that I owe.  It is showing that I have a $25 credit for that.  How do I fix this, I have been trying for days and all I have got from the e-mail tech support is that its my credit card issuer that is causing the problem.  Thats not correct because one of the credit cards that I am trying to use, is a prepaid Visa gift card.  I know that these work on I-tunes because I have used them before in the past.  I am getting very frustrated with this whole process, I just want to clear up my account and buy some new music!! HELP!!

    You probably ran into blocks & locks.
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html
    They'll sort it out.

  • TS2755 I have 2 phones on my apple id acct. And when I text message that person I am getting a duplicate message to myself. How do I stop this from happening

    I have 2 phones attached to my apple ID account and when I text message that person, I am getting a duplicate message sent back to me.  How do I stop this from happening?

    Make 3 different iCloud accounts and use ONLY for iMessage.   That will permanently fix your issue.

  • I want to set up the Time Machine and I would love to use the Time  Capsule but since I already have a wireless router I need suggestions on  what other external disks Apple could recommend to use with the Time Machine and  how to configure that disk

    I want to set up the Time Machine and I would love to use the Time
    Capsule but since I already have a wireless router I need suggestions on
    what other
    external disks Apple could recommend to use with the Time Machine and
    how to configure that disk.
    A complication that I need to resolve is the fact that I am using Vmware
    Fusion to be able to use Windows on my Mac. Now it seems that Time
    Machine is not backing up my files
    on that virtual Windows without additional configuration and my question
    is whether you can advise me here or whether this is only a matter for
    the Fusion virtual machine.

    If you want to use Time Capsule you can.. you simply bridge it and plug it into the existing router.. wireless can be either turned off or used to reinforce the existing wireless.. eg use 5ghz in the TC which is much faster than your 2.4ghz.
    You can also use a NAS.. many brands available but the top brands are synology, qnap and netgear readynas  series. These will all do Time Machine backups although how well always depends on Apple sticking to a standard. There are cheaper ones.. I bought a single disk zyxel which was rebadged and sold through my local supermarket. It actually works very well for TM at least on Snow Leopard. Major changes were made in Lion and again ML so do not instantly think it will work on later versions. I haven't tried it yet with those versions.
    Any external drive can be plugged into the mac. Use the one with the fastest connection or cheapest price according to your budget. USB2 drives are cheap and plentiful. But no where near as fast as USB3 or FW800. So just pick whichever suits the ports on your Mac. Interesting Apple finally moved to USB3 on their latest computers.
    TM should exclude the VM partition file.. it is useless backing it up from Mac OS side.. and will slow TM as it needs to backup that partition everyday for no purpose.. TM cannot see the files inside it to backup just the changes.
    You need to backup windows from windows. Use MSbackup to external drive.. if you have pro or ultimate versions you can backup to network drive. But MSbackup is a dog.. at least until the latest version it cannot restore the partition without first loading windows. There are about a zillion backup software versions for windows.. look up reviews and buy one which works for you. I use a free one Macrium Reflect which does full disk backups and is easy to restore.. to do incremental backups though you have to pay for it.

  • Firefox opens Google link in the same tab (the way I like it), but I can't figure how to keep that and still have YouTube windows pop-up in a new tab. Help?

    Hello, here is my problem: reading your mozilla support, I learned how to make Firefox open links in Google results in the same tab, that's the way I like it, but I still like to have my YouTube windows pop-up in a new tab (I participate in one forum, when I come to the YouTube window in some topic, I usually click on a small right-down button "watch on YouTube", and that always opens video it in a new tab; all until latest few updates of Firefox). Can this issue be corrected in about:config feature, and how? Sorry if my English isn't so glorious.
    Thanks a lot for answering, and best regards...

    Hello. I have just tried this add-on you suggested, and no change.
    And no, there was no some other add-on before, not that I know about it. Mainly, I need this option while I'm on a forum (IP board powered), it is not really something so important, but it's neat function for me.
    So, to be more detailed - I read a certain topic on this forum, and some of the posts from other members contain YouTube screens (looking same as on the original YouTube page), showing the frame of a video.
    In earlier versions of Firefox, I used to click on a small YouTube logo button (right side, down, between "watch on full screen" and "watch later" buttons). Clicking on this button automatically opened new tab, leaving forum tab as it is, and in new tab original YouTube page, with that certain video. In the same time, in Google search page, when clicking on a link, all links were opening in the same tab.
    Now, after some of the latest updates of Firefox, I noticed that some default settings were changed - in Google search, clicking on a link always opens a link in a new tab. I have found out here on your forum how to set this back in about:config feature, and now I have again that links in a Google results page are opened in the same tab (that's the way I like it).
    But YouTube screens on this forum are now also being opened in the same tab, and that is what I don't like, and trying to change back.
    So, what I need: all links to open in the same tab after clicking, as I have it now, and YouTube screens (e. g. on this forum) to be opened in a new tab (by clicking on a small YouTube logo ("watch this video on YouTube").
    Pedantic I am, I know that, and I know that this may look silly to some people, but if there is a way to do something, please tell me.
    Thanks for answering, and best regards.
    P.S.
    Is it possible that forum updates changed my setting, and not the Firefox? Thanks again...

Maybe you are looking for

  • [SOLVED] Problem copying objects in Inkscape 0.48.0-4

    I have problems when I copy any object when using inkscape. Even after removing the config directories and using a completely blank document. I create a simple rect and press ctr+c (or use the context menu) and this error comes up: El script inkex.py

  • Imposssible to connect to iTUNES store...

    It imposssible to connect to iTUNES store, both with iphone 3GS and iPAD 2. No apps update is possible. Can somebody help me?

  • Click event with modifiers

    Hello, I'm trying to select multiple lines of a matrix clicking on any fields of a row. I can capture the event of the click and select the line clicked, but I'm not able to select multiple lines that way. I need to select the lines with modifiers in

  • Numbers not synching across devices

    I continue to run into a synch problem with Numbers.  I have a spreadsheet that I update regularly, but when I open it, it regularly shows more than one spreadsheet and says they are out of synchronization and I need to pick one.  the latest message

  • Does Groupware portlet support Exchange server 2007

    Hi ALL, Does anyone had any idea, will the groupware portlet support Exchange server 2007. I tried with exchange 2003 is working with groupware. Please let me know any ideas to display email, calender, tasks in the portal. Thanks Manu.