Showing xml with xsl in a java webapplication

Dear members,
what are the possible ways to show an XML file in a web application written in java?
The xml file has to be transformed by a corresponding xsl file.
Regards,
Katja

bhupesh,
Try my solution described here:
/people/valery.silaev/blog/2005/11/23/display-formatted-text-using-webdynpro-for-java
final String xml = <yorXmlStringFromRfc>;
final IWDCachedWebResource resource = WDWebResource.getWebResource
    xml.getBytes("UTF-8"),
    WDWebResourceType.XML
resource.setResourceName("XML_inline.xml");
resource.setAttachement( false );
resource.setReadOnce( false );
wdComponentAPI.getWindowManager.createExternalWindow
  resource.getAbsoluteURL(), "XML Window Title", false
).open();
VS
Message was edited by: Valery Silaev

Similar Messages

  • Unable to transform XML with XSL in java code

    Hi,
    Could somebody please tell me what's wrong with my code, why it isn't transform the XML with XSL to the output that I want. If I use the command line to transform the XML, it output perfectly:
    java org.apache.xalan.xslt.Process -in marc.xml -xsl MARC21slim2MODS.xsl -out out.xml
    Here is the code of my program to transform the XML with XSL, I am using xalan-j_2_2-bin:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import org.w3c.dom.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.dom.*;
    import java.math.BigInteger;
    String xslDoc = "MODS.xsl";
    String xmlResult = "out.xml";
    DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
    dfactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
    Document xmlDoc = docBuilder.newDocument();
    Element root = xmlDoc.createElement("collection");
    root.setAttribute("xmlns", "http://www.loc.gov/MARC21/slim");
    xmlDoc.appendChild(root);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(new StreamSource(xslDoc));
    FileWriter fw = new FileWriter(new File(xmlResult));
    StreamResult output = new StreamResult(fw);
    transformer.transform(new DOMSource(xmlDoc), output);
    fw.flush();
    fw.close();
    ========================
    marc.xml -- source XML file
    ========================
    <?xml version="1.0" encoding="UTF-8"?>
    <collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01488cam 2200337 a 4500</leader><controlfield tag="001">2502929</controlfield><controlfield tag="005">19930521155141.9</controlfield><controlfield tag="008">920219s1993 caua j 000 0 eng </controlfield><datafield ind1=" " ind2=" " tag="035"><subfield code="9">(DLC) 92005291</subfield></datafield><datafield ind1=" " ind2=" " tag="906"><subfield code="a">7</subfield><subfield code="b">cbc</subfield><subfield code="c">orignew</subfield><subfield code="d">1</subfield><subfield code="e">ocip</subfield><subfield code="f">19</subfield><subfield code="g">y-gencatlg</subfield></datafield>
    </record></collection>
    ========================
    out.xml -- result using command line
    ========================
    <?xml version="1.0" encoding="UTF-8"?>
    <collection xmlns="http://www.loc.gov/mods/" xmlns:xlink="http://www.w3.org/TR/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/ http://www.loc.gov/standards/marcxml/schema/mods.xsd">
    <mods>
    <titleInfo>
    <title>Arithmetic</title>
    </titleInfo>
    <name type="personal">
    <namePart>Sandburg, Carl</namePart>
    <namePart type="date">1878-1967</namePart>
    <role>creator</role>
    </name>
    </mods>
    </collection>
    ========================
    out.xml -- result using my java program
    ========================
    <?xml version="1.0" encoding="UTF-8"?>
    <collection xmlns="http://www.loc.gov/mods/" xmlns:xlink="http://www.w3.org/TR/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/ http://www.loc.gov/standards/marcxml/schema/mods.xsd">01488cam 2200337 a 4500250292919930521155141.9920219s1993 caua j 000 0 eng (DLC) 920052917cbcorignew1ocip19y-gencatlgpc16 to br00 02-19-92; br02 to SCD 02-21-92; fd11 02-24-92 (PS3537.A618 A...); fa00 02-26-92; fa05 03-02-92; fm31 03-06-92; CIP ver. pv08 04-16-93; pv01 to CLT 04-20-93; lb10 05-21-93
    </collection>

    I am using the same XSL file. My Java program use the same XSL file I used in the command line.
    It is possible that my Java code is using a different parser, but I developed a seperate program to parse the XML using the same parser that my Java code is using. It output the result I expected. Here is the code for the program:
    import java.io.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    public class Convertor {
    public static void main(String[] args) throws Exception {
    String xslDoc = "MARC21slim2MODS.xsl";
    String xmlResult = "out.xml";
    String xmlDoc = marc.xml";
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(new StreamSource(xslDoc));
    StreamSource xmlSource = new StreamSource(xmlDoc);
    FileWriter fw = new FileWriter(new File(xmlResult));
    StreamResult output = new StreamResult(fw);
    transformer.transform(xmlSource, output);
    }

  • How can I use JavaScript extention functions with Xalan for transforming XML with XSL

    While transforming standart XML and XSL files to HTML with this servlet:
    package mypackage1;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.net.URL;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import org.mozilla.javascript;
    public class Servlet2 extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    try
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new FileReader("c:/aaa.xml"));
    Source xslSource = new StreamSource(new FileReader("c:/bbb.xsl"));
    Transformer transformer = tFactory.newTransformer(xslSource);
    transformer.transform (xmlSource, new StreamResult(out));
    catch (Exception e)
    e.printStackTrace();
    everything is going ok,
    but when try to use javascript function in XSL file, for example like in this:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:lxslt="http://xml.apache.org/xslt" xmlns:my-ext="ext1"
    extension-element-prefixes="my-ext">
    <lxslt:component prefix="my-ext"
    functions="getdate">
    <lxslt:script lang="javascript">
    function getdate() {
    var d = new Date();
    return d.toUTCString();
    </lxslt:script>
    </lxslt:component>
    <xsl:template match="/">
    <p><xsl:copy-of select="my-ext:getdate()"/></p>
    </xsl:template>
    </xsl:stylesheet>
    recieve error-message:
    XSL-1000: (Fatal Error) Error while parsing XSL file (Extension function namespace should start with 'http://www.oracle.com/XSL/Transform/java/'.).
    What kind of namespace I should specify?

    Hello, Paul.
    I'm sure you may not use JavaScript as a language for creating XSLT extention functions with Oracle XDK Parser. This is since parser might have JavaScript interpreter to work with JavaScript, but it has not.
    If you need to build any XSLT extention functions you must build them as Java class' static methods.
    After that, you define the usage of the class by mean of namespace declaration as:
    xmlns:your-ns="http://www.oracle.com/XSL/Transform/java/yourpackage.Yourclass"
    (Prefix "http://www.oracle.com/XSL/Transform/java/" may differs if you use non-Oracle XML parser)
    and use class' static method in XSLT:
    <xsl:value-of select="your-ns.staticMethodName(paramsIfAny)"/>
    In your case you may wish to use standard Date class:
    xmlns:date="http://www.oracle.com/XSL/Transform/java/java.util.Date"
    <xsl:value-of select="date:toString(date:new)"/>

  • Php with xsl on Sun Java Web Server 7.0

    Hi anyone,
    i installed php as nsapi via phppack. Now i need xsl support in php. I've tryed to compile php with the following line (php 5.2.6):
    ./configure with-nsapi=/export/netscape_71 enable-force-cgi-redirect with-gettext with-zlib --with-xsl=/usr/lib64/php5/extensions
    magnus.conf, obj.conf and mime.types are assimilate to this article:
    http://developers.sun.com/webtier/reference/techart/php2.html
    After compiling, i copy the libphp5.so in the .plugins/php/ dir an restart the webserver.
    He stops with this message:
    failure: CORE2253: Error running Init function load-modules: dlopen of /export/netscape_71/plugins/php/libphp5.so failed (/export/netscape_71/plugins/php/libphp5.so: wrong ELF class: ELFCLASS64)
    failure: server initialization failed
    What's going wrong?
    How i get xsl Support on Sun Java Web Server?
    thanks!

    essential wrote:
    ./configure with-nsapi=/export/netscape_71 enable-force-cgi-redirect with-gettext with-zlib --with-xsl=/usr/lib64/php5/extensionsYou are pointing to 64-bit library path. Change it to 32-bit library path.
    failure: CORE2253: Error running Init function load-modules: dlopen of /export/netscape_71/plugins/php/libphp5.so failed (/export/netscape_71/plugins/php/libphp5.so: wrong ELF class: ELFCLASS64)
    failure: server initialization failedThis means that it expects a 32-bit library but it found a 64-bit one.

  • Issue with XSL transformation in Java Stored Procedure

    Hi,
    Am having issue applying XSL transformation in Java Stored procedure. I have loaded the java class as well as .XSL files through loadjava uility and their status in DB is VALID.
    Below is the code in the java stored procedure:
    public static String tranform(String strInputXML ){
    URL url = ClassLoader.getSystemClassLoader().getResource(first.xsl);
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new ByteArrayInputStream (strInputXML.getBytes("UTF-8")));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    StreamSource stylesource = new StreamSource(url.openStream());
    Transformer transformer = tFactory.newTransformer(stylesource);
    When I run this procedure, am getting following errors:
    {color:#ff0000}*ERROR: 'No such file or directory'*
    FATAL ERROR: 'Could not compile stylesheet'{color}
    My first.xsl file has reference to other excel file (Ex: &lt;xsl:include href="second.xsl"/&gt;) which seems to be causing this error. When I remove the reference, procedure is working fine.
    Pls let me know how to resolve this and read the .XSL file with references.
    Thanks,

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • UCCheck Showing error with XSL statement

    We are preparing to convert to Unicode and my XSL scripts are failing in UCCheck.  It appears my XSLT script (Z_EBPP_FINAL_OUTPUT_CSV) is fine, but the SAP created code behind it is failing (Z_EBPP_FINAL_OUTPUT_CSV=======XT) on the first line "<xsl:transform version="1.0"
    with an error message = "Statement "<XSL" is not defined. Check your spelling."
    Has anyone experienced this problem before?  If so, how did you fix it?
    Thanks,
    Ken Kammer
    The Reynolds and Reynolds Co.

    Here is the code that is causing the problem:  Unicode is saying the first line is in error in the SAP generated code from the XSLT.
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sapxsl="http://www.sap.com/sapxsl"
      xmlns:asx="http://www.sap.com/abapxml"
    >
    <xsl:output encoding="iso-8859-1" method="text"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="asx:abap/asx:values">
    <xsl:text>Bill To,</xsl:text>
    <xsl:apply-templates select="SOURCE/_-1BEA_-S_CRMB_BDH_WRK/PAYER"/>,<xsl:text/>
    <xsl:apply-templates select="ADDINFO/PAYERNAME"/><xsl:text>
    </xsl:text>
    <xsl:text>Invoice No.,</xsl:text>
    <xsl:apply-templates select="SOURCE/_-1BEA_-S_CRMB_BDH_WRK/HEADNO_EXT"/><xsl:text>
    </xsl:text>
    <xsl:text>Date,</xsl:text>
    <xsl:apply-templates select="SOURCE/_-1BEA_-S_CRMB_BDH_WRK/BILL_DATE"/><xsl:text>
    </xsl:text>
    <xsl:apply-templates select="INVOICEITEMS"/>
    </xsl:template>
    <xsl:template match="INVOICEITEMS">
    <xsl:text>Ship To,Name,Line #,Ref #,Order Number, Quantity,Description,Customer Price,Extended Price,Allowance Amount,Net Price
    </xsl:text>
    <xsl:apply-templates select="INVOICEITEM/SOURCE"/>
    </xsl:template>
    <xsl:template match="INVOICEITEM/SOURCE">
    <xsl:apply-templates select="ZZSHIP_TO_CUST"/>,<xsl:text/>
    <xsl:apply-templates select="ZZSHIP_TO_CUST_NAME"/>,<xsl:text/>
    <xsl:apply-templates select="ITEMNO_EXT"/>,<xsl:text/>
    <xsl:apply-templates select="ZZCONTRACT"/>,<xsl:text/>
    <xsl:apply-templates select="ZZLEGACY_ORDER"/>,<xsl:text/>
    <xsl:apply-templates select="ZZQTY_SHIPPED"/>,<xsl:text/>
    <xsl:text>"</xsl:text>
    <xsl:apply-templates select="ZZPROD_DESC"/>",<xsl:text/>
    <xsl:apply-templates select="ZZUNIT_PRICE"/>,<xsl:text/>
    <xsl:apply-templates select="ZZGROSS_PRICE"/>,<xsl:text/>
    <xsl:apply-templates select="ZZDISC_AMOUNT"/>,<xsl:text/>
    <xsl:apply-templates select="NET_VALUE"/><xsl:text>
    </xsl:text>
    </xsl:template>
    <xsl:template match="ZZSHIP_TO_CUST|ZZSHIP_TO_CUST_NAME|ITEMNO_EXT|ZZCONTRACT|ZZLEGACY_ORDER|ZZPROD_DESC|PAYER|PAYERNAME|HEADNO_EXT|BILL_DATE">
    <!-- this is for string value nodes -->
    <xsl:value-of select="normalize-space(.)"/><xsl:text/>
    </xsl:template>

  • Table: Only show XML with a certain value?

    I am building a table from an xml file and it is working great if I ask it to show every node.
    But I only want the row to be added if it matches a particular value in the xml.
    For example my xml has values for name, rating and enrollment.
    So something like...
    if ({@rating}=="acceptable"){
                   <tr spry:repeat="ds1" >
                           <td width="300">{@name}</td>
                           <td width="150">{@rating}</td>
                           <td width="150">{@enrollment}</td>
                   </tr>
    Any suggestions would be appreciated.
    Thanks.

    Set setXPath is probably the best way to go. See here http://labs.adobe.com/technologies/spry/samples/data_region/SetURL.html#

  • 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.

  • JAVA to XML on runtime a,then using thatstream along with XSL genertateHTML

    hi everybody,
    can u give me a example of a java file which generates an xml file on runtime and passes it as a stream to XSLT processor along with XSL file to produce and html output.
    i would appreciate this becoazue i know how to use physical file with XSLTprocessor but i am not able to pass an XML generated at runtime as a stream to the transformer class as a source.

    Hi Sumit
    See the links below for examples on doing this:
    http://xml.apache.org/xalan-j/
    http://xml.apache.org/xalan-j/samples.html
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun mcirosystems inc
    http://www.sun.com/developers/support

  • Transfer 100M XML file with XSL

    Hi,
    I am trying to transfer 100M XML file with XSL. Input.xml is the XML file, format.xsl is the XSL file. I type in the command line as:
    java org.apache.xalan.xslt.Process -IN input.xml -XSL format.xsl -OUT output.xml
    It got "out of memeory" error. My questions are:
    1. Is it possible to transfer such large XML file with XSLT?
    2. The XSL processor used SAX or DOM to parse XML file?
    3. Any suggestions?
    Thanks.
    James

    maybe?
    java -Xmx200m org.apache.xalan.xslt.Process -IN input.xml -XSL format.xsl -OUT output.xml
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java-classic.html

  • Split XML files with XSL result document

    Hi All,
    I have below xml file...
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <T0020
    xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1">
    <INTERFACE>
    <NAME>SAFER</NAME>
    <VERSION>04.02</VERSION>
    </INTERFACE>
    <TRANSACTION>
    <VERSION>01.00</VERSION>
    <OPERATION>REPLACE</OPERATION>
    <DATE_TIME>2009-09-01T00:00:00</DATE_TIME>
    <TZ>CT</TZ>
    </TRANSACTION>
    <IRP_ACCOUNT>
    <IRP_CARRIER_ID_NUMBER>274845</IRP_CARRIER_ID_NUMBER>
    <IRP_BASE_COUNTRY>US</IRP_BASE_COUNTRY>
    <IRP_BASE_STATE>AR</IRP_BASE_STATE>
    <IRP_ACCOUNT_NUMBER>55002</IRP_ACCOUNT_NUMBER>
    <IRP_ACCOUNT_TYPE>I</IRP_ACCOUNT_TYPE>
    <IRP_STATUS_CODE>100</IRP_STATUS_CODE>
    <IRP_STATUS_DATE>2007-11-06</IRP_STATUS_DATE>
    <IRP_UPDATE_DATE>2009-08-03</IRP_UPDATE_DATE>
    <IRP_NAME>
    <NAME_TYPE>LG</NAME_TYPE>
    <NAME>A P SUPPLY CO</NAME>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>PH</ADDRESS_TYPE>
    <STREET_LINE_1>1400 N OATS</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>71854</ZIP_CODE>
    <COUNTY>MILLER</COUNTY>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>MA</ADDRESS_TYPE>
    <STREET_LINE_1>P O BOX 1927</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>75504</ZIP_CODE>
    <COUNTY/>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    </IRP_NAME>
    </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    and i want to take this xml file and split it into multiple files through java code like this ...
    File1.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    File2.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    so i have applied following xslt ...
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://www.safersys.org/namespaces/T0020V1" version="2.0">
    <xsl:output method="xml" indent="yes" name="xml" />
    <xsl:variable name="accounts" select="t:T0020/t:IRP_ACCOUNT" />
    <xsl:variable name="size" select="10" />
    <xsl:template match="/">
    <xsl:for-each select="$accounts[position() mod $size = 1]">
    <xsl:variable name="filename" select="resolve-uri(concat('output/',position(),'.xml'))" />
    <xsl:result-document href="{$filename}" format="xml">
    <T0020>
    <xsl:for-each select=". | following-sibling::t:IRP_ACCOUNT[position() < $size]">
    <xsl:copy-of select="." />
    </xsl:for-each>
    </T0020>
    </xsl:result-document>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Now i want to apply this XSL to xml through Java Code...
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xslSource = new StreamSource(xslFilePath);
    Transformer trans = tFactory.newTransformer(xslSource);
    trans.transform(new StreamSource(xmlFileName), new StreamResult( ????));
    here how can i map new StreamResult( ) input parameter with xsl Result document argument ??
    Please help me.....
    Or Can you give me a link of Example which use result document and Java transform method to Output multiple doucment ??
    Here new StreamResult take only 1 file as to be transformed ....

    hi Tejas ,
    I have done as you said but now able to generate multiple xml file .
    I am giving you the xsl file i have used ....
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://www.safersys.org/namespaces/T0020V1" version="2.0">
         <xsl:output method="xml" indent="yes" name="xml" />
         <xsl:variable name="accounts" select="t:T0020/t:IRP_ACCOUNT" />
         <xsl:variable name="size" select="5" />
         <xsl:template match="/">
              <xsl:for-each select="$accounts[position() mod $size = 1]">
                   <xsl:variable name="filename" select="concat(position(),'.xml')" />
                        <xsl:result-document href="{$filename}" format="xml">
                             <T0020>
                                  <xsl:for-each select=". | following-sibling::t:IRP_ACCOUNT[position() < $size]">
                                       <xsl:copy-of select="." />
                                  </xsl:for-each>                              
                             </T0020>
                        </xsl:result-document>                    
              </xsl:for-each>
         </xsl:template>
    </xsl:stylesheet>
    and i have done transformation like this ...
    Transformer trans = tFactory.newTransformer(xslSource);
    trans.transform(new StreamSource(xmlFileName), new DOMResult());
    but not getting any result .
    Can you please help me out ?
    - Nisarg

  • XML data not displayed with XSL

    I have just started learning XML so bear with me. I have a xml document that I created and want to use a stylesheet to display it in html but it doesn't seem to be working. Here is the xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet href="XSL\myXSL.xsl" type="text/xsl"?>
    <GstBk:Book xmlns:GstBk="http://www.testurl.com">
    <GstBk:Guest>
    <GstBk:Address>
    <GstBk:Name>John Doe</GstBk:Name><GstBk:From>Anywhere USA</GstBk:From>
    </GstBk:Address>
    </GstBk:Guest>
    </GstBk:Book>
    And here is the xsl document:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:GstBk="http://www.testurl.com"
    version="1.0"
    >
    <xsl:template match="GstBk:Book">
    <html>
    <head>
    <title>Guest Book</title>
    </head>
    <body>
    <xsl:apply-templates />
    </body>
    </html>
    </xsl:template>
    <xsl:template match="GstBk:Guest">
    Name = <xsl:value-of select="GstBk:Name" />
    </xsl:template>
    </xsl:stylesheet>
    But the only data I get on the browser is:
    Name =
    Can anyone see something wrong with my files? I have downloaded examples from the net and they seem to work. I even compared them to my files and can't see anything obviously different. Any ideas?
    Thanks

    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:GstBk="http://www.testurl.com">
       <xsl:template match="GstBk:Book">
          <html>
             <head>
                <title>Guest Book</title>
             </head>
             <body>
                <xsl:apply-templates />
             </body>
          </html>
       </xsl:template>
       <xsl:template match="GstBk:Guest">
          Name = <xsl:value-of select="GstBk:Address/GstBk:Name" />
       </xsl:template>
    </xsl:stylesheet>This style sheet with the xml you provided works for me. I use Xalan 2.1.0 for the transformation with the command line: java org.apache.xalan.xslt.Process -in your.xml -xsl your.xsl
    and I get this for the output:
    <html xmlns:GstBk="http://www.testurl.com">
    <head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Guest Book</title>
    </head>
    <body>
          Name = John Doe
    </body>
    </html>If you still see a different result, let me know what your environment is.

  • Xml file with xsl style sheet reference

    I am trying to learn this from a book, I copied the code like
    it shows, but the page on the server keeps coming back with an
    error starting on line 54 involving the four "End If" quotes. I
    have tried everything I can think of and can't get it to work. Any
    help would be greatly appreciated.
    Here's the code:
    <%@Language=VBScript%>
    <%option explicit%>
    <%
    dim domDoc
    dim aFilename
    Dim node
    Dim nodes
    dim mainNodes
    dim mainnode
    dim attr
    dim root
    Set domDoc = Server.CreateObject("MSXML.DOMDocument")
    afilename =server.MapPath("ch19i1.xml")
    if not domDoc.load(afilename) then
    Response.Write "Could not load the file " & aFilename
    & "<br>"
    Response.End
    end if
    %>
    <html>
    <head></head>
    <body>
    <%
    ' display the root node
    set root = domDoc.documentElement
    Response.Write "<h1>" & root.nodename & ": "
    & root.nodevalue & "</h1>"
    Set mainNodes = root.childNodes
    For Each mainNode in mainNodes
    If mainNode.hasChildNodes = False Then
    Response.Write "<h2>" & mainNode.nodeName & ":
    " & mainNode.text & "</h2><br>"
    Else
    Response.Write "<h3>" & mainNode.nodeName & ":
    " & mainNode.text & "</h3>"
    Set nodes = mainNode.childNodes
    If nodes.lenght > 0 Then
    Set node = nodes(0)
    If Not node.Attributes Is Nothing Then
    If node.Attributes.lenght > 0 Then
    Response.Write "<table border='1'>"
    Response.Write "<thead>"
    For Each attr In node.Attributes
    Response.Write "<th>" & attr.nodeName &
    "</th>"
    Next
    Response.Write "</tr>"
    For Each node In nodes
    Response.Write "<tr>"
    For Each attr In node.Attributes
    If attr.nodeValue = "" Then
    Response.Write "<td>" & " " &
    "</td>"
    Else
    Response.Write "<td>" & attr.nodeValue &
    "</td>"
    End If
    Next
    Response.Write "</table>"
    End If
    End If
    End IF
    End If
    Next
    %>
    </body>
    </html>

    Is the error message displayed in Firefox or in IE, or in a customized window that doesn't identify the browser?
    ''If it displays in Firefox:''
    It's possible that the Troubleshooter doesn't work correctly unless IE is your default browser. You could test that possibility by having IE make itself the default and testing the Troubleshooter again.
    ''If it displays in IE or embedded in another Microsoft application:''
    In a web search I found these suggestions:
    (1) Reset your Internet Explorer settings, according to http://answers.microsoft.com/en-us/ie/forum/ie8-windows_7/cannot-view-xml-using-xsl-style-sheet/ccfe80c6-c0db-4594-a7e3-475f9eac0e85
    (2) Try the System File Checker, according to http://ask-leo.com/why_do_i_get_the_xml_page_cannot_be_displayed_after_running_a_microsoft_troubleshooter.html
    Any luck?

  • How do I enable flash and java on firefox23 as I have the latest versions installed yet the plugin page shows "disabled" with no option to enable

    I have updated to Firefox 23 and it disabled my Java and Flash plugins. I then updated these to Flash 11.8.800.94 and Java to Version 7 Update 25. Now these are showing up on the plug in page but are showing "disabled" with no option to enable. How do I enable them to view content on the web.

    Thanks Philipp but i have already done that and the content started working...
    However, when i closed and restarted the browser it returned back to the same settings...
    I dont think that should happen, but anyway thank you for the solution. At least I can use it by resetting the values if need be
    Appreciate your help

  • How to insert into table from a xml with XDE for java?

    want to insert into the oracle tables from the xml with XDE for java, some sample better. thank you.

    XML Document may be stored in a SQL database with XML SQL Utility.
    http://download-west.oracle.com/docs/cd/B13789_01/appdev.101/b10794/adx08xsu.htm#i1008168
    XML Document may be stored in a SQL database with Oracle XML DB.
    http://download-west.oracle.com/docs/cd/B13789_01/appdev.101/b10790/xdb03usg.htm#CEGFECFH

Maybe you are looking for

  • I tried to install windows and forgot to partition a drive?

    So i bought a copy of windows to install on my Macbook Air and i forgot to partition a drive for it. I selected the "boot with disk" option and then i restarted. So windows setup starts but i would have to format a system drive to run it. If my disc

  • Can I implement XI in a WAS 6.20 and R/3 Environment??

    Can I implement XI in a WAS 6.20 and R/3 Environment?? R/3 being 4.60C OR R/3 Enterprise?? Thanks Sean

  • C How to Set Isolation Level in the Connection String

    How to Set Isolation Level in the Connection String using the "Microsoft OLE DB Provider for DB2 Version 4.0"? We are trying to move from Crystal Reporting that run against a IBM DB2 database on a mainfram to SSRS reporting and we have downloaded the

  • How to blur (non-moving) objects in video

    Hi - I've been trying for 2 hours to just blur something out of a video to no avail, using rectangle mask, then 'gaussient' filter. All I see on the screen, even after increasing the "amount" of blur to maximum setting, is a red rectangle. The blur e

  • Where to find the jar fie  for the following packages

    Hi All, Can any one help me to find out the Following jar file. i am unable to find the jar file for these package. import com.sapportals.wcm.repository.ICollection; thanks in advance.