XSLT & C parser

Hi,
Is it in Oracle XML team plans to provide XSLT in C (integrated
or not with the XML C parser) ?
I could not find the answer in the forum archives. Apologies if
it is a FAQ.
Eric
null

Eric Gouriou (guest) wrote:
: Hi,
: Is it in Oracle XML team plans to provide XSLT in C
(integrated
: or not with the XML C parser) ?
: I could not find the answer in the forum archives. Apologies
if
: it is a FAQ.
: Eric
A v2 version of the C and C++ Parsers incorporating XSLT support
is coming by Dec.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null

Similar Messages

  • XSLT for payload with namespaces

    Hello Experts,      attn:Stefan.
      I am using a XSLT to parse the input xml payload and retrieve the Value of a particular field which will be used for receiver determination.
    The XSL code used by me is :
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
    <ns1:Receivers xmlns:ns1="http://sap.com/xi/XI/System">
    <Receiver>
    <Service>
    <xsl:value-of select="NemRefusionIndberetningSamling/NemRefusionIndberetningStruktur/HeaderStruktur/ReferenceAttributTekst" />
    </Service>
    </Receiver>
    </ns1:Receivers>
    </xsl:template>
    </xsl:stylesheet>
    And the input payload I am getting is something like:
    <?xml version="1.0" encoding="utf-8"?>
    <NemRefusionIndberetningSamling >
         <DannetDatoTid>2010-04-22T12:14:28.036+02:00</DannetDatoTid>
         <NemRefusionIndberetningStruktur xmlns="urn:oio:abc:nemrefusionindberetning:2009.07.03" MessageID="1">
              <HeaderStruktur xmlns="urn:oio:abc:nemrefusionheader:2009.07.03">
                   <FravaerTypeKode>Sygdom</FravaerTypeKode>
                   <FravaerendeStruktur>
                        <FravaerendeTypeKode>Loenmodtager</FravaerendeTypeKode>
                        <LoenUnderFravaerIndikator>false</LoenUnderFravaerIndikator>
                   </FravaerendeStruktur>
                   <IndberetningUUIDIdentifikator>bf9cc44e-af15-4e19</IndberetningUUIDIdentifikator>
                   <ReferenceAttributTekst>S70CLNT007</ReferenceAttributTekst>
              </HeaderStruktur>
         </NemRefusionIndberetningStruktur>
    </NemRefusionIndberetningSamling>
    The XSLT works fine with above payload. But now we need to add namespaces in top level elements. So the payload will be like:
    <NemRefusionIndberetningSamling xmlns="urn:oio:abc:nemrefusionsamling:2009.07.03" UUIDIdentifikator="DF8C1CB43B2E14F1A0C5005">
    <DannetDatoTid>2010-04-22T12:14:28.036+02:00</DannetDatoTid>
         <NemRefusionIndberetningStruktur xmlns="urn:oio:abc:nemrefusionindberetning:2009.07.03" MessageID="1">
              <HeaderStruktur xmlns="urn:oio:abc:nemrefusionheader:2009.07.03">
                   <FravaerTypeKode>Sygdom</FravaerTypeKode>
                   <FravaerendeStruktur>
                        <FravaerendeTypeKode>Loenmodtager</FravaerendeTypeKode>
                        <LoenUnderFravaerIndikator>false</LoenUnderFravaerIndikator>
                   </FravaerendeStruktur>
                   <IndberetningUUIDIdentifikator>bf9cc44e-af15-4e19</IndberetningUUIDIdentifikator>
                   <ReferenceAttributTekst>S70CLNT007</ReferenceAttributTekst>
              </HeaderStruktur>
         </NemRefusionIndberetningStruktur>
    </NemRefusionIndberetningSamling>
    Top element being changed by addition of namespace, XSLT fails to retriev the value of required field i.e. <ReferenceAttributTekst>
    Changed element:
    "<NemRefusionIndberetningSamling xmlns="urn:oio:abc:nemrefusionsamling:2009.07.03" UUIDIdentifikator="DF8C1CB43B2E14F1A0C5005">"
    I am sure that there should be a way to handle namespaces in XSLT. Please suggest me the correction to XSLT to handle this namespace addition to top element.
    Kind Regards,
    Abhijeet.

    In XSLT you put a prefix before the XPATH rule like this:
    p1:root/p2:subnode/element
    you declare the namespaces in header as attribute xmlns:p1="..."
    Something like:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p1="..." ...>
    In your example you have to consider, that namespaces without prefix are inherited to subnodes. That means you have to build your XPATH like this:
    p1:NemRefusionIndberetningSamling/p2:NemRefusionIndberetningStruktur/p3:HeaderStruktur/p3:ReferenceAttributTekst

  • Parser v.2.0.2.9 vs. parser v.2.1.0 behavior

    I have tried transformation to html from xml-document containing
    multiple Chapters & sections. When using parser v.2.0.2.9 following code works.
    First tranformation with id.xsl generates xml with id's and
    title / header numbers. Transformations with body.xsl, glossary.xsl
    & toc.xsl produce separate html files. When part that produces tempfile.xml
    (marked with >) is replaced with commented code, parser v.2.0.2.9 fails to
    do the transfromation to html.
    I changed to new parser v.2.1.0 and the commented code works also,toc.xsl and glossary.xsl
    works fine but the tranformations with body.xsl fail! I get the html files, but they contain
    no data.
    What might cause this behavior???
    /* instanciate new DOM-parser */
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    /* Parse XML-message */
    FileInputStream xmlArg = new FileInputStream(args[0]);
    parser.setValidationMode(true);
    parser.parse(xmlArg);
    XMLDocument xml = parser.getDocument();
    System.out.println("XML-document " + args[0] + " parsed.");
    /* Parse XSLT (create id's & numbering) */
    parser.setValidationMode(false);
    FileInputStream idIN = null;
    try{
    idIN = new FileInputStream("id.xsl");
    } catch (FileNotFoundException ex){
    System.out.println("error - File: id.xsl not found on " + idIN);
    return;
    parser.parse(idIN);
    XMLDocument idXDoc = parser.getDocument();
    XSLStylesheet idXSLT = new XSLStylesheet(idXDoc,null);
    /* Parse XSLT (for text body) */
    FileInputStream bodyIN = null;
    try{
    bodyIN = new FileInputStream("body.xsl");
    } catch (FileNotFoundException ex){
    System.out.println("error - File: body.xsl not found on " + bodyIN);
    return;
    parser.parse(bodyIN);
    XMLDocument bodyXDoc = parser.getDocument();
    XSLStylesheet bodyXSLT = new XSLStylesheet(bodyXDoc,null);
    /* Parse XSLT (for table of contents) */
    FileInputStream tocIN = null;
    try{
    tocIN = new FileInputStream("toc.xsl");
    } catch (FileNotFoundException ex){
    System.out.println("error - File: toc.xsl not found on " + tocIN);
    return;
    parser.parse(tocIN);
    XMLDocument tocXDoc = parser.getDocument();
    XSLStylesheet tocXSLT = new XSLStylesheet(tocXDoc,null);
    /* Parser XSLT (for Glossary) */
    FileInputStream glossIN = null;
    try{
    glossIN = new FileInputStream("glossary.xsl");
    } catch (FileNotFoundException ex){
    System.out.println("error - File: glossary.xsl not found on " + glossIN);
    return;
    parser.parse(glossIN);
    XMLDocument glossXDoc = parser.getDocument();
    XSLStylesheet glossXSLT = new XSLStylesheet(glossXDoc,null);
    System.out.println("XSLT-styleheets parsed. ");
    /* Create processor */
    XSLProcessor pro = new XSLProcessor();
    pro.showWarnings(true);
    System.out.println("Starting transformations to HTML.");
    /* WORKS WITH BOTH PARSER VERSIONS */
    > out = new FileOutputStream("tempfile.xml");
    > pro.processXSL(idXSLT,xml,out);
    > out.close();
    > in = new FileInputStream("tempfile.xml");
    > parser.parse(in);
    > XMLDocument tempResult = parser.getDocument();
    /* THIS PART WORKS WITH V.2.1.0 NOT WITH V.2.0.2.9 */
    /* XMLDocumentFragment temp = pro.processXSL(idXSLT,xml);
    XMLDocument tempResult = new XMLDocument();
    tempResult.appendChild(temp); */
    out = new FileOutputStream("chapter\\toc.html");
    pro.processXSL(tocXSLT,tempResult,out);
    out.close();
    out = new FileOutputStream("chapter\\glossary.html");
    pro.processXSL(glossXSLT,tempResult,out);
    out.close();
    int lkm = tempResult.selectNodes("UserManual/Chap").getLength();
    System.out.println(lkm + " chapters.");
    for(int k = 1;k < (lkm +1); k++){
    String slice1 = String.valueOf(k);
    String tempNumber = String.valueOf(k) + ".";
    String path = "UserManual/Chap[Title/@number = '" + tempNumber + "']/Sec";
    int sec = tempResult.selectNodes(path).getLength();
    System.out.println(" Chapter " + slice1 + " to " + sec + " slices.");
    if (sec != 0 ){
    for(int p=1;p < (sec+1);p++){
    String fileName = "chapter\\slice" + tempNumber + p + ".html";
    outHTML = new FileOutputStream(fil eName);
    String slice2 = String.valueOf(p);
    bodyXSLT.setParam("Chap",slice1);
    bodyXSLT.setParam("Sec",slice2);
    pro.processXSL(bodyXSLT,tempResult,outHTML);
    out.close();
    System.out.println(fileName + " ready");
    else{
    String fileName = "chapter\\slice" + tempNumber + "html";
    outHTML = new FileOutputStream(fileName);
    bodyXSLT.setParam("Chap",slice1);
    pro.processXSL(bodyXSLT,tempResult,outHTML);
    out.close();
    System.out.println(fileName + " ready");
    System.out.println("Tranformation complete.");
    null

    I found a problem in body.xsl file which solved the transformation problem...funny that it still worked with the v.2.0.2.9?
    My old xsl file started like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="ISO-8859-1" />
    <xsl:param name="Chap">2</xsl:param>
    <xsl:param name="Sec">2</xsl:param>
    <xsl:param name="Next">NEXT.gif</xsl:param>
    <xsl:param name="Previous">PREVIOUS.gif</xsl:param>
    <xsl:variable name="Ch">
    <xsl:value-of select="concat($Chap,'.')"/>
    </xsl:variable>
    <xsl:variable name="S">
    <xsl:value-of select="concat$Chap,'.',$Sec,'.')"/>
    </xsl:variable>
    <xsl:template match="UserManual">
    <html>
    <head>.......
    when I changed the two variables under
    <xsl:template match="UserManual"> transformation worked correctly with v.2.1.0!
    null

  • Converting XML(as String) to XML(XMLObject) in WLI8.1

    Hi,
    I am new to WLI 8.1. In my business process I receive an XML from client as Java
    String. Now I want to convert it into com.bea.xml.XMLObject to perform XSL Transformation.
    How do I do it in WLI workshop.
    Is it possible in WLI8.1 to use XML in the form of Java String as Input/Output
    for XSL Transformation.
    Thanks in advance
    Ashish

    I can think of 2 options.
    a) Take the generated XMLObject for the XML as input to JPD - this is the default
    behaviour when you use WLW when you configure you client request control method
    to take the XSD as the input.
    b) If you to take java.lang.String as input to the JPD method then by default
    the transformation tool does NOT parse it as XML. You will have to write custome
    code (using xquery/xpath or supply an xslt) to parse the XML to build the XMLObject.
    The client would still send an XML request in both scenarios... and so both the
    above options would not impact clients.
    Hope this helps...
    Vishwa
    "Ashish Agrawal" <[email protected]> wrote:
    >
    Hi,
    I am new to WLI 8.1. In my business process I receive an XML from client
    as Java
    String. Now I want to convert it into com.bea.xml.XMLObject to perform
    XSL Transformation.
    How do I do it in WLI workshop.
    Is it possible in WLI8.1 to use XML in the form of Java String as Input/Output
    for XSL Transformation.
    Thanks in advance
    Ashish

  • Transforming multiple documents with x:transform

    Hello,
    I am trying to use x:transform to apply a transformation to a document that combines content from other documents. I have been trying to use x:param to pass in the other supporting documents as node-sets but I am getting errors as follows:
    <c:import url="/WEB-INF/xslt/transform.xslt" var="xslt" />
    <x:parse varDom="propertiesNS" doc="${propertiesXmlStr}"/>
    <x:transform xml="${main.xml}" xslt="${xslt}">
         <x:param name="properties"  value="${propertiesNS}"/>
    </x:transform>...throws: Invalid conversion from 'com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl' to 'node-set'
    So I tried using x:set to force a node-set result - my reading of the spec suggests that the result of x:set should node-set compatible with x:transform.
    <c:import url="/WEB-INF/xslt/transform.xslt" var="xslt" />
    <x:parse varDom="propertiesNS" doc="${propertiesXmlStr}"/>
    <x:set var="propertiesNS2" select="$propertiesNS/Properties"/>
    <x:transform xml="${main.xml}" xslt="${xslt}">
         <x:param name="properties"  value="${propertiesNS2}"/>
    </x:transform>...throws: "Invalid conversion from 'org.apache.taglibs.standard.tag.common.xml.JSTLNodeList' to 'node-set'"
    Any ideas?
    I appreciate that I could use document() but the supporting docs are in memory so I'd have to write a URIResolver but as far as I can see I'd have to specify a custom TransformerFactory to attach the URIResolver to the Transformer and i don't really want to do that as I imagine the default one includes optimisations etc.
    Many thanks for any help.
    Andy

    ANNOUNCEMENT: Would you like to help us improve Adobe Reader?
    Hi All,
    We have had a few bug reports related to Adobe Reader X protected mode coming in from you in this forum. We have addressed a large number of them in our upcoming Reader update and we would like to hear your feedback.
    To that extent, we would like to invite you to the Adobe Reader Prerelease program and try out the latest build. To participate, please fill in the form available at https://www.adobe.com/cfusion/mmform/index.cfm?name=reader_prerelease_ interest and indicate Adobe Reader as the product of your interest.
    We look forward to your active participation, feedback and help towards making Reader a better product.
    Thanks and regards,
    Adobe Prerelease Team

  • PAYMUL-XML mapping

    Hi Everyone,
    Can anyone help me where i can get mapping guide for PAYMUL-XML payment file ?

    Hi Krishna,
    You must be referring to XSLT mapping.
    In XSLT, we parse XMl source message and generate outbound structure as required.
    It works based on template and Xpath.
    For that it would be good if you can use somne editors like Altova XML spy.
    You will find many blogs on XSLT mapping.
    After writing XSLT mapping , you need to zip the xsl file(XSLT file has xsl extension) then import that zip file under Imported Archives in IR.
    We normally use XSLT mapping, when graphical mapping becomes more complex.
    As XSLT can easily read, process XML source message which XI has received and produces target structure required by receiver application system.
    We will prefer XSLT when:
    Nested structure: In case of multiple nested structure especially in ccase of IDocs, we use XSLT mapping
    Maintaining the sequence of the input structure: If you want to maintain the sequence of the data fromt he incoming file.
    It would be good if you start doing and you will get better idea about it.
    Ref:
    http://www.w3schools.com/xsl/default.asp
    http://help.sap.com/saphelp_nw04/helpdata/en/83/2200cb50d345c793336d9a1683163e/frameset.htm
    H. Nested structure: In case of multiple nested structure especially in ccase of IDocs, we use XSLT mapping
    2. Maintaining the sequence of the input structure: If you want to maintain the sequence of the data fromt he incoming file.
    Hope this will help.
    Regards,
    Divyesh

  • Swapping XML Parser and XSLT to Xalan 2.7.0 - Not Working (OC4J 10.1.3)

    Hi-
    I'm trying to use the latest Xercies/Xalan classes in OC4J 10.1.3 as described in the How-To swap XML Parsers document:
    http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html
    What I can see happening is that the oracle.xml shared library is successfully 'turned off', but the xalan libraries are not added. Instead, the default xml classes that are distributed with the JDK become visible. For instance, using a slightly modified version of the index.jsp page from the how-to, I get this result:
    ------ Output from JSP page ----------------
    TransformerFactory Instance: org.apache.xalan.processor.TransformerFactoryImpl
    Transformer Instance: org.apache.xalan.transformer.TransformerIdentityImpl
    Transformer Version: Xalan Java 2.4.1 (!!)
    What I expect is for that last line to say version 2.7.0, which is the version of the xalan.jar included in my shared library (code to add that line to the how-to shown below).
    I suspect what is happening is that the class loader is simply not letting a shared library override a system library - to do that you probably need to place the jar files in system endorsed directory.
    Has anyone gotten this how-to to work - actually replacing the XML parser/transform classes with the latest Xalan classes? Are you sure it is seeing the current version you placed in the shared library?
    Thanks,
    Eric Everman
    ---- My modified getXSLTDetails() method in the index.jsp page of the how-to -------
    <!-- Additional Import -->
    <%@ page import="org.apache.xalan.Version" %>
    public static String getXSLTDetails()
    Transformer transformer=null;
    TransformerFactory transformerfactory = TransformerFactory.newInstance();
         Version ver = null;
         String br = "<" + "br" + ">"; //otherwise the otn forum chocks on the break.
    try
    transformer = transformerfactory.newTransformer();
              ver = (Version) transformer.getClass().forName("org.apache.xalan.Version").newInstance();
              String ret_val =
                   "TransformerFactory Instance: "+transformerfactory.getClass().getName() + br +
                   "Transformer Instance: "+transformer.getClass().getName() + br;
              if (ver != null) {
                   ret_val = ret_val + "Transformer Version: " + ver.getVersion() + br;
              } else {
                   ret_val = ret_val + "Transformer Version not Available" + br;
              return ret_val;
    catch (Exception e)
    e.printStackTrace();
    return e.getMessage();
    }--------------------------------------------------------------------

    Steve - Thanks for responding on this.
    The Xalan SQL extension is built into Xalan. The most painless way to try it out is to run it via JEdit: www.jedit.org
    JEdit a OS Java application with a fairly painless install process (I'm assuming you already have a current JRE installed). Once its installed, you'll need to install the XSLT plugin - in JEdit goto Plugins | Plugin Manager | Install and pick the XSLT plugin. You'll need the Oracle JDBC classes on your classpath - this can be done by copying the oracle_jdbc4.jar into the [JEdit install directory]/jars directory.
    Restart to load that jar and you should be all set.
    I included a sample XSLT page at the bottom of this post that is somewhat of a template transform for the SQL extension - its more complicated then it needs to be, but it does some nice things with the results of the query. Save it as a file and make the appropriate changes to the 'datasource' parameter near the top of the file.
    Then in JEdit, open the file and make sure the XSLT plugin is visible (Plugins | XSLT | XSLT Processor Toggle - or alternately dock it in the window via global prefs). In the XSLT plugin: Allow the current buffer to be used as the source, Add that same file as a stylesheet via the '+' button, and pick a result file at the bottom. Then click the 'Transform XML' button.
    Troubleshooting: I seem to remember having some classpath errors when I tried this on windows, but others have had it work w/o issues. I do remeber that the XSLT plugin had a popup window that gave a pretty good explaintion of the problem, if it occurs. Also, for some reason the XSLT plugin will not create a new file for the output, so its often best to create a file first, then choose it as the output. Of course, you can always run a transformation from the command line or w/in an applicatoin. Full docs on the Xalan SQL extension can be found at: http://xml.apache.org/xalan-j/extensionslib.html#sql
    Here is my sample XSLT transform using the SQL extension:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:sql="http://xml.apache.org/xalan/sql"
              xmlns:str="http://exslt.org/strings"
              xmlns:xalan="http://xml.apache.org/xalan"
              extension-element-prefixes="sql str xalan">
         <xsl:output indent="yes"/>
         <xsl:param name="driver">oracle.jdbc.OracleDriver</xsl:param>
         <xsl:param name="datasource">jdbc:oracle:thin:jqpublic/jqpublic@server_name:1521:dbname</xsl:param>
         <xsl:param name="jndiDatasource"><!-- jndi source for production use w/in enterprise environment --></xsl:param>
         <xsl:param name="debug">true</xsl:param>
         <xsl:variable name="connection" select="sql:new()"/>
         <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
         <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
         <!--
              The query:  You could pass parameters in to this query to build a where clause, but here is a simple example.
              Also, its nice to wrap the query with a max row number to prevent huge results.
         -->
         <xsl:param name="query">
         select * from (
      SELECT
              'One' FIELD_1,
              'Two' FIELD_2
         FROM DUAL
         ) where rownum < 100
         </xsl:param>
         <!-- Essentially, create a XConnection object -->
         <xsl:variable name="connection" select="sql:new()"/>
         <xsl:template match="/">
        <xsl:choose><!-- Connect using JNDI -->
          <xsl:when test="$jndiDatasource != ''">
            <xsl:if test="not(sql:connect($connection, $jndiDatasource))">
              <xsl:message>Failed to connect to db via jndi connection</xsl:message>
              <xsl:comment>Failed to connect to db via jndi connection</xsl:comment>
              <xsl:if test="$debug = 'true'">
                <xsl:copy-of select="sql:getError($connection)/ext-error"/>
              </xsl:if>
            </xsl:if>
          </xsl:when>
          <xsl:otherwise><!-- Connect using connection string -->
            <xsl:if test="not(sql:connect($connection, $driver, $datasource))">
              <xsl:message>Failed to connect to db via driver/url connection</xsl:message>
              <xsl:comment>Failed to connect to db via driver/url connection</xsl:comment>
              <xsl:if test="$debug = 'true'">
                <xsl:copy-of select="sql:getError($connection)/ext-error"/>
              </xsl:if>
            </xsl:if>
          </xsl:otherwise>
        </xsl:choose>
              <!--
              The results of the query.  The rowset is brought back in 'streaming' mode,
              so its not possible to ask it for the number of rows, or to check for zero
              rows.  There is a switch to disable streaming mode, but this requires all
              rows to be brought into memory.
              -->
              <xsl:variable name="table" select="sql:query($connection, $query)"/>
              <xsl:if test="not($table)">
                   <xsl:message>Error in Query</xsl:message>
                   <xsl:copy-of select="sql:getError($connection)/ext-error"/>
              </xsl:if>
              <page>
                   <!-- Your xalan environment -->
                   <xsl:copy-of select="xalan:checkEnvironment()"/>
                   <!-- Build a bunch of metadata about the rows -->
                   <meta>
                        <cols>
                             <xsl:apply-templates select="$table/sql/metadata/column-header"/>
                        </cols>
                   </meta>
                   <rowset>
                        <!--
                             With streaming results, you must use the apply-temmplates contruct,
                             not for-each, since for-each seems to attempt to count the rows, which
                             returns zero.
                        -->
                        <xsl:apply-templates select="$table/sql/row-set"/>
                   </rowset>
              </page>
              <xsl:value-of select="sql:close($connection)"/><!-- Always close -->
         </xsl:template>
         <xsl:template match="row">
              <row>
                   <xsl:apply-templates select="col"/>
              </row>
         </xsl:template>
         <xsl:template match="column-header">
              <col>
                   <xsl:attribute name="type">
                        <xsl:value-of select="@column-typename"/>
                   </xsl:attribute>
                   <xsl:attribute name="display-name">
                        <xsl:call-template name="create-display-name"/>
                   </xsl:attribute>
                   <xsl:value-of select="@column-name"/>
              </col>
         </xsl:template>
         <!-- Convert column names to proper caps: MY_FIELD becomes My Field -->
         <xsl:template name="create-display-name">
              <xsl:variable name="col-name">
                   <xsl:for-each select="str:tokenize(@column-name, '_')">
                        <xsl:value-of
                             select="concat(translate(substring(., 1, 1), $lowercase, $uppercase), translate(substring(.,2), $uppercase, $lowercase), ' ')"/>
                   </xsl:for-each>
              </xsl:variable>
              <xsl:value-of select="substring($col-name, 1, string-length($col-name) - 1)"/>
         </xsl:template>
         <!-- Creates data columns named 'col' with a column-name attribute -->
         <xsl:template match="col">
              <col>
                   <xsl:attribute name="column-name"><xsl:value-of select="@column-name"/></xsl:attribute>
                   <xsl:value-of select="."/>
              </col>
         </xsl:template>
    </xsl:stylesheet>

  • XML Parser for Java v2. Applying XSLT to DOM tree

    I encountered pretty weird behavior of XML Parser for Java v2.
    While applying XSLT to XML document created in memory using DOM
    interface I couldn't access element attributes. For example,
    given the XML document:
    <root>
    <Item ID="00001">Value of Item 00001</Item>
    <Item ID="00002">Value of Item 00002</Item>
    </root>
    and XSLT:
    <xsl:template match="/">
    <HTML>
    <HEAD>
    <TITLE>XSLT Test</TITLE>
    </HEAD>
    <BODY>
    <xsl:for-each select="/Error">
    <H1>Error</H1><xsl:value-of select="."/>
    </xsl:for-each>
    <TABLE border="0" cellspacing="0" cellpadding="2">
    <TBODY>
    <xsl:for-each select="/root">
    <TR>
    <TH style="background-color:khaki">
    <xsl:text>Attribute</xsl:text>
    </TH>
    <TH style="background-color:khaki">
    <xsl:text>Value</xsl:text>
    </TH>
    </TR>
    <xsl:for-each select="Item">
    <TR>
    <TD><xsl:value-of select="@ID"/></TD>
    <TD><xsl:value-of select="."/></TD>
    </TR>
    </xsl:for-each>
    </xsl:for-each>
    </TBODY>
    </TABLE>
    </BODY>
    </HTML>
    </xsl:template>
    If I build DOM tree by parsing XML file the resulting HTML
    document after applying XSLT will display
    Attribute Value
    00001 Value of Item 00001
    00002 Value of Item 00002
    But if I build DOM tree using following code:
    XMLDocument xDoc = new XMLDocument();
    Element root = xDoc.createElement( "root" );
    xDoc.appendChild( root );
    Element elem = xDoc.createElement( "Item" );
    elem.setAttribute( "ID", "00001" );
    root.appendChild( elem ).
    appendChild( xDoc.createTextNode( "Value of Item 00001" ) );
    elem = xDoc.createElement( "Item" );
    elem.setAttribute( "ID", "00002" );
    root.appendChild( elem )
    .appendChild( xDoc.createTextNode( "Value of Item 00002" ) );
    the same XSLT will produce the following HTML output:
    Attribute Value
    Value of Item 00001
    Value of Item 00002
    So the value for the ID attribute is not displayed. At the same
    time I can access this attribute using DOM interface. For
    example, following code
    NodeList nList = xDoc.getElementsByTagName( "Item" );
    Element e;
    for( int i = 0; i < nList.getLength(); i++ )
    e = (Element)nList.item( i );
    System.out.println( "ID: " + e.getAttribute( "ID" ) );
    produces an output
    ID: 00001
    ID: 00002
    Here is the code for applying XSLT to DOM tree:
    DOMParser parser = new DOMParser();
    parser.parse( new FileInputStream( "test.xsl" ) );
    XMLDocument xsldoc = parser.getDocument();
    XSLStylesheet xsl = new XSLStylesheet( xsldoc, createURL( "" ) );
    XMLDocument out = new XMLDocument();
    out.appendChild( new XSLProcessor().processXSL(xsl, xDoc) );
    out.print( new FileOutputStream( "test.html" ) );
    Andrei Filimonov
    null

    We are not getting what you're getting on Solaris. See the
    following:
    Script started on Tue Jun 22 18:53:56 1999
    Processing /view/test/vobs/oracore3/.ndeprodrc.csh
    Processing /private/.nderc.csh
    [test] > cat bruno.xml
    <my_grandpa age="88">
    <my_dad age="66">
    <me age="44">
    <my_son age="22">
    </my_son>
    </me>
    </my_dad>
    </my_grandpa>
    [test] > cat bruno.xsl
    <?xml version="1.0"?>
    <!-- Identity transformation -->
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    <xsl:template match="me">
    <xsl:value-of select="my_son/@age"/>
    <xsl:value-of select="@age"/>
    <xsl:value-of select="../@age"/>
    <xsl:value-of select="../../@age"/>
    </xsl:template>
    </xsl:stylesheet>
    [test] > java XSLSample bruno.xsl bruno.xml
    <root>
    22446688
    </root>
    [test] > exit
    script done on Tue Jun 22 18:54:22 1999
    What platform are you on and does your stylesheet and xml doc
    match ours?
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Bruno Bontempi (guest) wrote:
    : I had a similar problem in accessing element attributes from
    an
    : XSLT sheet.
    : It seems like the processor correctly accesses element
    attributes
    : in the context node, but does not retrieve values of
    attributes
    : outside the context node.
    : For example, for an XML document like:
    : <my_grandpa age="88">
    : <my_dad age="66">
    : <me age="44">
    : <my_son age="22">
    : </my_son>
    : </me>
    : </my_dad>
    : </my_grandpa>
    : and an XSL stylesheet like:
    : <xsl:template match="me">
    : <xsl:value-of select="my_son/@age"/>
    : <xsl:value-of select="@age"/>
    : <xsl:value-of select="../@age"/>
    : <xsl:value-of select="../../@age"/>
    : </xsl:template>
    : I expect an output like:
    : 22446688
    : but all I get is
    : 44
    : I am also using Jim Clark's XT, which is returning the
    expected
    : result.
    : Thanks in advance for your help,
    : Bruno.
    : Andrei Filimonov (guest) wrote:
    : : I encountered pretty weird behavior of XML Parser for Java
    v2.
    : : While applying XSLT to XML document created in memory using
    DOM
    : : interface I couldn't access element attributes. For example,
    : : given the XML document:
    : : <root>
    : : <Item ID="00001">Value of Item 00001</Item>
    : : <Item ID="00002">Value of Item 00002</Item>
    : : </root>
    : : and XSLT:
    : : <xsl:template match="/">
    : : <HTML>
    : : <HEAD>
    : : <TITLE>XSLT Test</TITLE>
    : : </HEAD>
    : : <BODY>
    : : <xsl:for-each select="/Error">
    : : <H1>Error</H1><xsl:value-of select="."/>
    : : </xsl:for-each>
    : : <TABLE border="0" cellspacing="0" cellpadding="2">
    : : <TBODY>
    : : <xsl:for-each select="/root">
    : : <TR>
    : : <TH style="background-color:khaki">
    : : <xsl:text>Attribute</xsl:text>
    : : </TH>
    : : <TH style="background-color:khaki">
    : : <xsl:text>Value</xsl:text>
    : : </TH>
    : : </TR>
    : : <xsl:for-each select="Item">
    : : <TR>
    : : <TD><xsl:value-of select="@ID"/></TD>
    : : <TD><xsl:value-of select="."/></TD>
    : : </TR>
    : : </xsl:for-each>
    : : </xsl:for-each>
    : : </TBODY>
    : : </TABLE>
    : : </BODY>
    : : </HTML>
    : : </xsl:template>
    : : If I build DOM tree by parsing XML file the resulting HTML
    : : document after applying XSLT will display
    : : Attribute Value
    : : 00001 Value of Item 00001
    : : 00002 Value of Item 00002
    : : But if I build DOM tree using following code:
    : : XMLDocument xDoc = new XMLDocument();
    : : Element root = xDoc.createElement( "root" );
    : : xDoc.appendChild( root );
    : : Element elem = xDoc.createElement( "Item" );
    : : elem.setAttribute( "ID", "00001" );
    : : root.appendChild( elem ).
    : : appendChild( xDoc.createTextNode( "Value of Item
    00001" )
    : : elem = xDoc.createElement( "Item" );
    : : elem.setAttribute( "ID", "00002" );
    : : root.appendChild( elem )
    : : .appendChild( xDoc.createTextNode( "Value of Item
    00002" )
    : : the same XSLT will produce the following HTML output:
    : : Attribute Value
    : : Value of Item 00001
    : : Value of Item 00002
    : : So the value for the ID attribute is not displayed. At the
    same
    : : time I can access this attribute using DOM interface. For
    : : example, following code
    : : NodeList nList = xDoc.getElementsByTagName( "Item" );
    : : Element e;
    : : for( int i = 0; i < nList.getLength(); i++ )
    : : e = (Element)nList.item( i );
    : : System.out.println( "ID: " + e.getAttribute( "ID" ) );
    : : produces an output
    : : ID: 00001
    : : ID: 00002
    : : Here is the code for applying XSLT to DOM tree:
    : : DOMParser parser = new DOMParser();
    : : parser.parse( new FileInputStream( "test.xsl" ) );
    : : XMLDocument xsldoc = parser.getDocument();
    : : XSLStylesheet xsl = new XSLStylesheet( xsldoc, createURL
    : : XMLDocument out = new XMLDocument();
    : : out.appendChild( new XSLProcessor().processXSL(xsl, xDoc) );
    : : out.print( new FileOutputStream( "test.html" ) );
    : : Andrei Filimonov
    null

  • JSP XML file parsing XSLT using Xalan

    Hi all
    I have created an XML file "view_campaign.xml" using JSP as shown in a code below and i wanna know how i should proceed to parse the XML file and so i can display this XML as the XSLT file i created.
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%
    // Identify a carriage return character for each output line
    int iLf = 10;
    char cLf = (char)iLf;
    // Create a new empty binary file, which will content XML output
    File outputFile = new File("C:\\WebContent\\view_campaigns.xml");
    //outputFile.createNewFile();
    FileWriter outfile = new FileWriter(outputFile);
    // the header for XML file
    outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
    try {
         // Define connection string and make a connection to database
         //DriverManager.registerDriver (new org.apache.derby.jdbc.ClientDriver());
         Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/sample","app","app");
         Statement stat = conn.createStatement();
         // Create a recordset
         ResultSet rset = stat.executeQuery("Select * From campagn");
         // Expecting at least one record
         if( !rset.next() ) {
              throw new IllegalArgumentException("No data found for the campaigns table");
         outfile.write("<campaigns>"+cLf);
         outfile.write("<campaign>"+cLf);
         outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
         outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
         outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
         outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
         outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
         outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
         outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
         outfile.write("</campaign>"+cLf);
         // Parse our recordset
    // Parse our recordset
         while(rset.next()) {
              outfile.write("<campaign>"+cLf);
              outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
              outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
              outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
              outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
              outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
              outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
              outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
              outfile.write("</campaign>"+cLf);
         outfile.write("</campaigns>"+cLf);
         // Everything must be closed
         rset.close();
         stat.close();
         conn.close();
         outfile.close();
    catch( Exception er ) {
    %>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    this is my .XSL file
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <!--  DWXMLSource="view_campaigns.xml"
      -->
      <!DOCTYPE xsl:stylesheet (View Source for full doctype...)>
    - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
    - <xsl:template match="/">
    - <html xmlns="http://www.w3.org/1999/xhtml">
    - <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Gestion des campagnes</title>
      </head>
    - <body>
      Gestion des campagnes
    - <table border="1">
    - <tr bgcolor="#9acd32">
      <th align="left">Code</th>
      <th align="left">Nom</th>
      <th align="left">Type</th>
      <th align="left">Client</th>
      <th align="left">Nombre de positions</th>
      <th align="left">Date d'ouverture</th>
      <th align="left">Date de cl�ture</th>
      </tr>
    - <xsl:for-each select="campaigns/campaign">
    - <tr>
    - <td>
      <xsl:value-of select="campaign_id" />
      </td>
    - <td>
      <xsl:value-of select="campaign_name" />
      </td>
    - <td>
      <xsl:value-of select="campaign_type" />
      </td>
    - <td>
      <xsl:value-of select="client" />
      </td>
    - <td>
      <xsl:value-of select="positions" />
      </td>
    - <td>
      <xsl:value-of select="begin" />
      </td>
    - <td>
      <xsl:value-of select="close" />
      </td>
      </tr>
      </xsl:for-each>
      </table>
      </body>
      </html>
      </xsl:template>
      </xsl:stylesheet>I would be greatful that u answer my question what i should do have any exemple case study.

    Hi,
    Try this code
    JspWriter out = pageContext.getOut(); // Get JSP output writter
          javax.xml.transform.TransformerFactory tFactory = javax.xml.transform.TransformerFactory.newInstance(); //Instantiate a TransformerFactory.           
          String realPath = "c:/applyXsl.xsl";
          java.io.File file = new java.io.File(realPath); // crearte a file object for given XSL.
          // Use the TransformerFactory to process the stylesheet Source and  generate a Transformer.           
          javax.xml.transform.Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource(file));
          java.io.StringReader inputStream = new java.io.StringReader("c:/xmlFile.xml"); // create an input stream for given XML doc
          java.io.ByteArrayOutputStream obj = new java.io.ByteArrayOutputStream(); // Create an output stream for XSL applied XML doc.
          // 3. Use the Transformer to transform an XML Source and send the output to a Result object.
          transformer.transform(new javax.xml.transform.stream.StreamSource(inputStream), new javax.xml.transform.stream.StreamResult(obj));
          String outputString = obj.toString(); // get the XSL applied applied XML document for print
          out.println(outputString); // print the XSL applied XML in to JSP.
    however you need xercesImpl.jar  and xml-apis.jar files  to run this program.
    Regards,
    Ananth.P

  • XSLT PARSER

    Hi
    Do we have any xslt parser kind of support in Flex? I want to
    parse an xslt file and render the results in flex datagrid.
    Thanks

    No.
    You might google to see if anyone has buillt an AS3 library
    for this but I have not heard of one.
    Tracy

  • Approach on parsing an XML file (JAXP, JAXB, DOM, SAX, XSLT)

    I have a pretty basic xml file that contains a database table name, fields, and sort order. My job is to read the XML file, construct the query based on the information in the nodes, and then output it in various ways. I know I can use JAXP, JAXB, DOM, SAX, and XSLT for this.
    I have the experience doing this using DOM. I have read up on JAXP, JAXB, and XSLT. I'm having a little bit of a difficult time on chosing the most appropriate way to do this. Again, I've always done it using DOM, but I'm not so sure that is the best way to do it here. Just looking for some recommendations from people whom are more familiar with XML parsing and processing.

    markwagoner wrote:
    I tried several of those but found them rather tedious. Now I just use JDOM for everything, it make life much easier.It doesn't, actually. It kept your learning curve shallow, but that's all. If you were to invest some time in JAXB, you'd find it made life easier for some things. If you invested time in XSLT, it would make life easier. Endlessly working with JDOM is incredibly tiresome after a while. You just don't know it because you never invested enough in learning anything else.
    Don't bother posting any code to "enlighten" me as to how simple JDOM is. I've been using it for years.

  • Non-English characters processed correctly by XML Parser 2 XSLT?

    I'm trying to transform an XML document (parsed as an XMLDocmument) using an XSL stylesheet (parsed as an XSLStylesheet) and the XSLProcessor class in Java, I encounter the following problem:
    Non-US characters such as German umlauts, stored in the XML in &#xxx; style, are not processed properly. "|" (&#252;), for example, comes out as "C<". Is this a bug in the XSLProcessor class or am I doing something wrong? I'm using this stylesheet declaration:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml1/strict"> Or should I mess with the encoding attribute of the ?xml ...? PI?
    tia
    John Smith

    I have not specified any encoding.
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="completeproduct.xsl"?>
    <PRODUCT connection="demosample" xmlns:xsql="urn:oracle-xsql">
    <xsql:query>
    select * from products
    </xsql:query>
    should i specify encoding
    null

  • How to use document() function in PL/SQL XSLT parser ?

    The "XDB Developers Guide" documentation says on page 12-18
    >
    The application can use DBUriType objects:
    To make references, such as import or include, to related XSL stylesheets. You can encode these references within the XSL stylesheet itself.
    following this i added string like this to my stylesheet
    <xsl:apply-templates select="document('/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()')" mode="include"/>
    <xsl:cinclude href="/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()"/>
    But when XSLT processor reaches this, it fails.
    I also even tried like this
    <xsl:include href="/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()"/>
    but result is the same ;(((
    Generally - is there ANY way XSLT processor can deal with stylesheet which contains
    DBURI references to another stylesheets stored in XMLTYPE columns ?
    I'm currently in charge to develop a content management system for a huge corporate site,
    so i'm VERY interested to know - does this feature really exists on Oracle 9.2 ?
    Please ansver ASAP.

    BTW: following this link
    xsl:include within XSL stylesheet stored in XMLType column
    i've encountered that this theme has been asked but none from Oracle staff has answered on it yet ;(((((((

  • XSLT with DOM/C++ Parser

    Help,
    Anyone familiar with xslprocess class with DOM Parser for C++? My application needs to transform the original XML document, and then parse the new document (parse elements in tree). The example in the XDK demo directory (XSLSample.cpp) stops short of this. This demo/sample code simply output the newly transformed to the standard output (screen). My attempt to parse the newly transformed XML has been unsuccessful. Most of my code is base direcly from the sample:
    void
    DbXMLLoad::transformXML( const string& filename)
    xmlpar.xmlinit();
    strcpy(xml_doc, (char*)filename.c_str());
    xmlpar.xmlparse((oratext *), xml_doc, (oratext *) 0, flags);
    xslpar.xmlinit();
    strcpy(xsl_doc, "it2xxx.xsl");
    xslpar.xmlparse((oratext *), xsl_doc, (oratext *) 0, flags);
    respar.xmlparse((oratext *) result, (oratext *) 0, flags);
    xslproc.xslprocess(&xmlpar, &xslpar, &respar, &result);
    xslproc.printres(&respar.getDocumentElement(), 1);
    // Parse the newly transformed XML document????
    constructTree(result, 1);
    (void) xmlpar.xmlterm();
    (void) xslpar.xmlterm();
    (void) respar.xmlterm();
    void
    DbXMLLoad::constructTree(Node *node, word level)
    if (node) {
    dumpTree(node, level);
    if ((node->getType() !=DOCUMENT_TYPE_NODE) && node->hasChildNodes()) {
    nodes = node->getChildNodes();
    n_nodes = node->numChildNodes();
    for (i=0; i< n_nodes; i++)
    constructTree(nodes->item(i), level + 1);
    void
    DbXMLLoad::dumpTree(Node *node, uword level)
    switch (node->getType()) {
    case ELEMENT_NODE: // start database processing
    case TEXT_NODE: // continue database processing
    default:
    Appreciate your help. Thanks in advance
    Russ

    what is "respar"?What version of XDK do you use?

  • When clicking one of the link od WEb Application I am getting this error: Error loading stylesheet: Parsing an XSLT stylesheet failed. Same link works fine in IE

    I am using McAfee EPO 4.6.0 when trying to view agent log receiving the error above. I can view this log in IE...

    I am using McAfee EPO 4.6.0 when trying to view agent log receiving the error above. I can view this log in IE...

Maybe you are looking for

  • Portfolio pdf- why is text in different sizes on each page of pdf?

    Even though i have saved my images with text (always  font size 12) as the same size (eg. 10in x 10in at 100ppi),  each time i save the images as a pdf the pdf then has all different size text from image to image-  a complete mess as a portfolio. Als

  • Can you install the Office Web Application Server on one of the App Servers for SharePoint 2013?

    Hi, Is it possible to run Office Web Application Server (shows preview images for docs and allows Notepad, Word, Excel to work etc) on one of the SharePoint 2013 App Servers. I don't want to have to create a new server. It talks about setting up a fa

  • Contact form not working

    down load to third party web page looks fine click send says successful but i don't recessive mail any help??

  • Calling actionscript file package classes

    I have composed a simple actionscript class called "test.as" under this directory \project\as\test\. The test.as class is packaged as "package as.test". In my main flex file main.mxml, how can reference this test.as class without getting a complied e

  • Slow editing with cs4

    hello I have a laptop and I installed cs4 on it (32 bit) it is running very slow (it is ok with one single time line, but i need to work with 3 timelines and it moves like a snail or not at all) my computer ability is attached in a pic. helppppppp pl