Generate HTML from XML and XSLT

Hi,
I have asked in different forum but did not get my answer so asking here again
i want to generate a HTML file from XML and XSLT in a temp folder and then read it into a java.lang.String, so can email it or write to a database file.
how can i do it, is there any engine which will merger XML and XSLT and give a HTML file or a String as output
Ashish

Hi,
Follow the simple steps.
1) Create XML Document (I hope u have it)
2) Create XSL Stylesheet for your XML document
3) Put both files in one directory some where in your local system or web server upto u
4) Invoke the XML document from webbrowser and you are done.
http://localhost/test/Catalog.xml OR C:\XXXXDIR\test\Catalog.xml
For Ex: XML File Content, Catalog.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="Catalog.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
</catalog>
XSL File Content: Catalog.xsl
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>

Similar Messages

  • How to generate HTML from XML and XSL?

    Hi all,
    I am new to XML.
    Can I somehow see the HTML-Output of the XML-File, when I have the XSL-File too, but don't use any XML-Editor (XMLSpy) and FOP? I do not want use any additional tools - only the database tools.
    What I need for this?
    Do I need the XSLT-File too?
    I am waiting for your answers, when possible with examples please.
    Regards
    Leonid Pavlov

    Please post on the General XML forum.

  • How do I generate HTML from XML & XSL using XSL Processor ?

    I want to generate a HTML from XML & XSL using XDK for C on
    linux-8i.
    I run the XSLSample well.
    But it only generate a XML from a XML & a XSL.
    Can any one give me some advise or sample code?

    Just use HTML tags instead of xml tags in your stylesheet, and
    you'll generate HTML instead.
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
        <html>
          <body>
            <xsl:for-each select="ROWSET">
              <table border="1" cellspacing="0">
                <xsl:for-each select="ROW">
                  <tr>
                    <td><xsl:value-of select="EMPNO"/></td>
                    <td><xsl:value-of select="ENAME"/></td>
                  </tr>
                </xsl:for-each>
              </table>
            </xsl:for-each>
          </body>
        </html>
      </xsl:template>
    </xsl:stylesheet>

  • How To Generate Objects From XML and DTD?

    Are there tools to generate objects from dtd's and xml files?
    If this is not possible for some reason: is there a tool to generate classes from a dtd?
    I can not find the "XML Java Class Generator" (from oracle) anymore.

    XMLBeans
    There are other solutions, but I know this one is pretty good.

  • Using XML extraction from Oracle and XSLT data transformation

    Hi
    How can transfer data ie: Using XML extraction from Oracle and XSLT data transformation with java application?
    usually i use to do querying sql, getting data from table assinging to model class then send it to UI. how can i go for XML extraction form oracle?
    thanks

    Sorry, I don't understand what exactly you want to do. And I'm under the impression that you might not know exactly what you want to do as well. Could you explain a bit more detailed what you want to achieve?

  • How to generate xhtml from xml

    Hi All
    I've an application that will generate an xml file in this way:
    FileWriter salidaxml = new FileWriter(new File("reporteHP.xml"));
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = dbf.newDocumentBuilder();
    Document doc = docBuilder.newDocument();
    // Some nodes and elements added here
    TransformerFactory transFact = TransformerFactory.newInstance();
    Transformer trans = transFact.newTransformer();
    trans.setOutputProperty(OutputKeys.INDENT, "yes");
    trans.setOutputProperty(OutputKeys.METHOD, "xml");
    trans.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
    trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    Result result = new StreamResult(salidaxml);     
    try {               
        trans.transform(new DOMSource(doc), result);               
        transformer.transform(source, rslt);           
    } catch (TransformerException te) {               
        System.out.println(te.getMessageAndLocation());               
    throw te;           
    salidaxml.flush();           
    salidaxml.close();Code run ok but I want to know how could I add code to generate a xhtml file using a dtd and a xsl I've or at least how to add the following at the begin of the xml generated file:
    <?xml-stylesheet type="text/xsl" href="reporte.xsl"?>Thanks in advance
    <xl>

    Hi
    Thanks for your help but I really didn;t found what I'm lookin for in this page.
    This page explains how xslt transform xml in xhtml. I know this point, I want to know HOW could I make it from my application. I guess there are a transform class that could generate html from a xsl template, but I couldn't find the way to do it and couldn't find examples too.
    <xl>

  • Generating HTML from Structured FrameMaker 9

    Hi,
    My source files are in Structured FrameMaker 9. I need to generate the output in HTML format. Is there a method to do this? Can someone guide me through the process of generating an HTML output?
    Regards,
    Manish

    Hi Manish,
    You have a number of options. I'll briefly summarize a few, but all of them involve some measure of complexity so I wouldn't be able to "guide you through" any of them.
    - Use a third-party product specifically designed for this, such as Omni Systems' Mif2Go, Quadralay ePublisher, or Adobe Robohelp. If you buy the Adobe TechComm Suite, Robohelp is included. All of these products can convert any FrameMaker document to HTML, with varying levels of additional functionality related to the subsequent generation of common online help formats with that HTML.
    - Save your structured files to XML and then use XSLT as a post-process on that XML. This is the more complex option, but if you have the skills, it may be more attractive since you may not have to buy anything and you'll be able to easily customize the process however you want it.
    - Use the DITA structure definitions within FrameMaker, then use the DITA Open Toolkit as a post-process to generate HTML from the DITA XML. There is lots of complexity with this as well, but it has some attractiveness as the DITA structured applications and open toolkit are effectively off-the-shelf software. Additionally, everything is free, unless you want to enhance your DITA experience with a third-party addon like DITA FMx from Leximation (recommended).
    - Use XHTML as your structure definition within FrameMaker, then save as XML. You'll automatically have HTML when you save your files. FrameMaker includes a structure application for XHTML but I've never used it, so I don't know how well it works. With this option, you would have a more WYSIWYG conveniences while authoring but less control over variations in the HTML output.
    There may be more and there certainly are any myriad of combinations of these techiniques. Hopefully this will help get you started. If you did buy the TechComm Suite, consider RoboHelp as a starting point since you already paid for it. The third-party product route is the most expensive in terms of software purchasing, but it is usually the least complex.
    One additional note - You will see "Save As HTML" or similar somewhere in the FM menus. It is a very rudimentary feature that is not likely to serve your needs. Might be worth a try since it is already there, but don't get your hopes up on that one.
    Good luck,
    Russ

  • How to fetch data from XML and store it in internal table

    Hi All,
    Can anyone help me out, in fetching data from xml and store it in an internal table. Is there any standard function module is there?
    Regards,
    Karthick

    to do this you can either develop a XSLT program and use it with CALL TRNSFORMATION key word to tranform the XML into itab .
    (search the ABAP General forum, i have posted few samples)
    or simply use the following FM which converts your XML into a itab of name value pair (name would holw the element name and value would hold the value of the element) which you can then loop and read it to your itb.
    data:             xmldata type xstring .
    data: result_xml type standard table of smum_xmltb .
    data: return type standard table of bapiret2 .
    CALL FUNCTION 'SMUM_XML_PARSE'
      EXPORTING
        xml_input       = xmldata
      TABLES
        xml_table       = result_xml
        return          = return .
    Regards
    Raja

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • Examples related to XML and XSLT

    Hello friends,
    In relation to XML and XSLT
    1. As I can transform an XML file using XSLT.
    2. I view the XML file using XSLT
    3. XSL and XSLT files are equal...?
    Thanks for the support

    http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXPXSLT6.html

  • [svn] 3663: Dita xml and xslt support for SkinStates

    Revision: 3663
    Author: [email protected]
    Date: 2008-10-15 13:04:27 -0700 (Wed, 15 Oct 2008)
    Log Message:
    Dita xml and xslt support for SkinStates
    Bugs: SDK-17166
    QA: Yes
    Doc: No
    Tests: checkintests
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17166
    Modified Paths:
    flex/sdk/trunk/asdoc/templates/class-parts.xslt
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/TopLevelClassesGenerator.ja va

    http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXPXSLT6.html

  • Is there any util or ant build to generate xmlbeans from xml

    hi all
    is there any utility tools or ant build process that can generate xmlbeans from xml schema? thanks.

    exactly,
    here are some libraries which are open sources;
    http://java-source.net/open-source/pdf-libraries hope it's useful. :D

  • Issue generating pdf from xml template, data and StreamServer webservices

    We purchased Abode LiveCycle Premium Print ES4. It included a product called StreamServe which we planned to use to merge xml templates and data into a pdf file using a StreamServe webservice (for developers). It seems the StreamServe webservices are not equal to that task.  Can anyone offer a hint how this automated pdf generation can be achieved using LCPP?  (I suspect it can be done using Workbench but I don't know this to be a fact.)
    TIA,
    Bill

    Was that another shameless book plug??
    Sorry, gotta run. I just got word the Fed Ex delivery of my copy of your book just arrived. Do you 'e-sign' personalized copies?
    p.s. The preview of Chapter 7 (Transforming XML with XSLT) is great and filled with good clean examples and explanation.

  • Generating PDF with XML and XSL

    Hi, quick basic question...
    I'm trying to generate pdf doc from xml with xsl.
    I'm using following sample code from xml.apache.org
    response.setContentType("application/pdf");
    Driver driver =new Driver();
    driver.setOutputStream(response.getOutputStream());
    driver.setRenderer(Driver.RENDER_PDF);
    Transformer transformer=TransformerFactory.newInstance()
    .newTransformer(new StreamSource("foo.xsl"));
    transformer.transform(xmlsource, new SAXResult(driver.getContentHandler()));
    xmlSource is my regular xml that wants to be pdf.
    is foo.xsl any regular xsl that I use to coonvert xml into html?
    or is it some special xsl that is tailored for pdf.
    Is this what is called xsl-fo?
    Thanks
    IL

    Hi IL,
    XSLT can translate XML to something else. It is most suited to transforming to another tree-like format (XML, HTML, etc.) but can be 'asked' to produce other kinds of output, flat text for example.
    It is driven by an XSL file which is a series of patterns to match and output to produce.
    This XSL file can be used to generate another XML document in which the nodes come from the Formatting Object namespace. These describe, in generic terms the format of an output document based upon the contents of the original XML.
    The formatting object XML document can then be used as input to a formatting object XML processor which can generate PDF output from it.
    You may want to check out:
    www.w3c.org
    for all the stuff on XML, XSL, XSLT, Formatting Objects, etc., and:
    xml.apache.org
    for imformation on Xalan, which is an XSL processor and FOP, which is a formatting object processor.
    Hope that helps,
    Peter.

  • Invalid tag generated in result XML file, xslt mapping done using MAPFORCE

    HI
    My requirement is File to File using xslt mapping
    I have done a very simple XSLT mapping, but through MAPFORCE tool
    Here are the steps, I followed:
    1. Supplied source xsd and xml file to MAPFORCE
    2. Supplied target xsd file
    3. mapped it as required
    4. tested by supplying a sample xml file by clicking OUTPUT button, which displays perfect XML structure
    5. Clicked XSLT button and copied and created a new file with extension .xsl file
    6. Zipped the above xsl file
    7. imported into IR imported archives folder
    8. Selected the above xslt mapping in my Interface mapping.
    9. Now tested my Interface Mapping by supplying sample some data for the source structure.
    Now I got the error or warning "XML not well-formed" and got the successfull completion message window for my mapping when I proceed.
    Now when I clicked xml source button for the target structure, It displays the invalid tag and starting with "#default"
    So If I removed this particular tag at the first and last lines, it becomes a valid xml structure and able to see properly in my internet explorer
    Here is the result I am getting:
    <?xml version="1.0" encoding="UTF-8"?>
    <#default:MT_Student_Result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:xsltMappingScenarios C:/DOCUME~1/Satya/Desktop/MT_Student_Result.xsd">
      <Data>
        <Name>Khan Raj</Name>
        <Marks>
          <Total_Marks>166</Total_Marks>
        </Marks>
      </Data>
    </#default:MT_Student_Result>
    When I tested through MAPFORCE it generates absolutely valid XML structure when I clicked OUTPUT button on MAPFORCE, but not when I used the xslt mapping through my interface mapping.
    What is the error I am making or any step missing?
    Please help me!
    Edited by: Shilpa Shetty on Oct 9, 2008 4:17 AM
    Edited by: Shilpa Shetty on Oct 9, 2008 5:58 AM
    Edited by: Chris Rock on Oct 9, 2008 6:06 AM

    For some reason when I use MapForce tool to generate my xslt mapping source, it is generating the following statement in the xsl file.
         <xsl:namespace-alias stylesheet-prefix="n" result-prefix="#default"/>
    So at the root element of XML file, it is replacing the character n with '#default' for some reason, I don;t know the purpose of this.
    As you suggested, I changed the name space, still I experienced same problem.
    It is now resolved after removing the above xsl statement from the xsl file before creating/uploading the relevant zip file into archives folder.
    It works fine now. Thanks for the clue.

Maybe you are looking for