XML transformation using XSLT and Resin 2.1.11

I have the following problem:
I'm using a servlet to transform the xml files in my web-app to html. The servlet caches the ones transformed results. For each request it checks if there exists a cached result and if the result is based on the most actual xml file version (checking the "lastModified" method of java.io.File that represents the requested file).
This servlet works fine and without any errors.
My web-app also has some other servlets that use the xml transformation to generate a fragment of html code (the menu structure of my "normal" servlets is defined in one xml file for all other files and servlets).
After invoking these servlets (those that use the xml transformation to create their menu) the first described servlet (transformation of requested xml files) is not working "fine" any longer. All it results is the generated header and footer of the page (hard-coded in the XSL file). The complete content is lost.
Any ideas how to solve this problem?
Thanks in advance,
Thof

1. The cache:
The Hashtable is a field of my servlet called XMLTransformerServlet. The cache is not removed or deleted and none of its items is removed or deleted.
As I said: Caching works fine, wonderful, perfectly...
That's definitively not the problem.
2. Thread safety:
I've made all my servlet methods thread safe (just checked this...)
3. About the "anonymous" other servlet type that uses xml transformations:
Some of my servlets use a (thread safe) method to generate a fragment of html code that will show a simple menu structure. Therefore my web-app uses a file called menu.xml - by that way there's only one menu to maintain what makes sure that all my pages get the same menu structure (finally also the xsl file I'm using for "normal" xml transformation imports/includes and interprets this menu.xml).
The (thread safe) method has transforms the menu.xml file using a special xsl file (menu.xsl) and outputs the result to a StringWriter. From this StringWriter I obtain the code-fragment that will be returned by the method.
Before I saw the class StringWriter the first time I've used a temporary file to output the transformation result. Next I red in the file and returned its content.
Finally - this method is working fine and it's always returning the expected data.
4. The problem:
Sorry for repeating this all the time...
What I'm processing:
 - requesting some xml files -> XMLTransformerServlet is invoked and works fine:
   -> doGet checks the resource (if resource doesn't exist HTTP404 will be responded)
   -> doGet checks the caching state for this resource
      a) resource is in cache and no newer version of the File exists -> return cached element
      b) resource is in cache but a newer version exists in the file system -> recache and return newly cached element
      c) resource is not in cache -> cache the resource and return the newly cached element
 - requesting one of the other servlets (those that use xml transformation for menu generation)
   -> servlets invoked work fine
 - requesting a xml file:
   a) current version in cache -> return cached element
   b) no current version in cache -> transform the xml file and cache it
This last transformation of the requested xml file fails.
It is not failing in the sense of "throwing an exception"... it seems to work 100% fine and results a String that could be responded to the browser.
But stupidly it is not working fine...
Maybe (as you wrote) this is a bug (maybe in Resins xml transformation api).
Just thought someone else might have made a similar experience...

Similar Messages

  • XML transformation using XSLT in JSP page

    Hi,
    Please help, I'm getting this error when I try to render my xml file using an xsl style sheet in my JSP page. Am I missing a JAR? Thanks
    Error 500: org/apache/xalan/xslt/XSLTInputSource
    Here's xsl file
    <?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' version='1.0' encoding='UTF-8' indent='yes'/>
    <xsl:template match="/">
      <html>
      <body>
      <h2>My CD Collection</h2>
        <table border="1">
          <tr>
            <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>
    And here's my JSP page
    <%@taglib uri="http://jakarta.apache.org/taglibs/xsl-1.0" prefix="xsl"%>
    <html>
    <head><title>Phone Book</title></head>
    <body>
    <xsl:apply xml="/xml/book.xml" xsl="/xml/book.xsl" />
    </body>
    </html>
    And here's my xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!-- Edited with XML Spy v4.2 -->
    <catalog>
         <cd>
              <title>Empire Burlesque</title>
              <artist>Bob Dylan</artist>
              <country>USA</country>
              <company>Columbia</company>
              <price>10.90</price>
              <year>1985</year>
         </cd>
         <cd>
              <title>Hide your heart</title>
              <artist>Bonnie Tyler</artist>
              <country>UK</country>
              <company>CBS Records</company>
              <price>9.90</price>
              <year>1988</year>
         </cd>
    </catalog>

    i would think the browser should be able do the transformation itself, rather than having to do this transformation on the server.
    If you want to do this on the server, you can always try adding xalan.jar, xml-apis.jar and xercesImpl.jar to your server's lib directory, downloaded from
    apache.org

  • XML Transformation using XSLT

    Hi,
    I have a scenario where I need to perform an XML to XML transformation and I need to do this using XSLT mapping.
    I am using XMLSpy.
    Could somebody help me on this issue?Any weblogs that can help me on this?
    regards,
    Prashanth

    Hi Prashanth,
    You can do the xsl transformation in XMLSpy itself.First create your source xml file in XMLSpy by selecting file type as xml.After that create your xslt program file by selecting file type as xslt.
    Then you can use the xslt program for transformation of source xml into target xml by choosing menu XSL/XQuery->XSL Transformation.
    sample xsl code for an example:
    source xml structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
         <header>
              <detail>
    Detail1
    </detail>
              <detail>
    Detail2
    </detail>
         </header>
         <header>
              <detail>
    Detail3
    </detail>
         </header>
    </root>
    xsl program:
    <xsl:stylesheet version = '1.0'
         xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
    <xsl:template match="/">
         <root>
         <xsl:for-each select="//header">
               <idoc>
                <xsl:for-each select="detail">
                    <detail>
                          <xsl:value-of select="."/>
                       </detail>
                       </xsl:for-each>
                   </idoc>
              </xsl:for-each>
         </root>
    </xsl:template>
    </xsl:stylesheet>
    target xml structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
         <idoc>
              <detail>
    Detail1
    </detail>
              <detail>
    Detail2
    </detail>
         </idoc>
         <idoc>
              <detail>
    Detail3
    </detail>
         </idoc>
    </root>
    Hope this would help.
    Rgds
    Sudhakar.

  • How to modify an XML values using XSLT and Java

    Hi Friends,
    I wish to modify a simple xml to another xml using XSLT, please let me know what are the things i need to know to convert the XML to another XML.
    If somebody can give a sample code, it will be great...
    I wish to do the following sample conversion of XML
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <ROOT>
    <NAME>TEST1</NAME>
    </ROOT>so that the results look like below....
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <ROOT>
    <NAME>TEST2</NAME>
    </ROOT>Notice TEST1 is replaced with TEST2 in the 2nd XML, I wish to get that result...please help.
    Thanks and Regards,
    JG

    Thanks for your nice reply... do you have a sample code...

  • Simple XML to Text onversion using XSLT and Java?

    Hi all!
    I'm completly new to using XSLT and Java and are trying to convert a XML file into a ordinary Textfile that I am gonna import into another application.
    I started up writing a ordinary XML parser in Java which interpreted the XML file, but realized later on that it was possible to do with a ordinary XSLT.
    So far it is a 2-step process right now, I've tied my XSLT to the XML file and then just open the XML file up in a ordinary browser and then get the result.
    I found an example (http://www.onjava.com/pub/a/onjava/excerpt/java_xslt_ch5/index.html?page=3) where u hook up a XML file and a XSL file separately and the process it, and dump it to Stdout. But do I need to hook up a XSL file like this when the XML file is tied to a XSL file internally?

    Just to give you an example to show you how easy it is: http://www.daniweb.com/forums/thread137587.html

  • How to update XML file using XSLT

    Hi there,
    I have a "small" issue with exporting data to an XML file using XSLT.
    A two steps process is needed to import data from a non-hierarchical XML file into ABAP, change the data, and then update the XML file with new values. The problem is not trivial, since the format of the XML file is a complex one: there are many interdependent elements on the same level, pointing to each other by using id and ref attributes. Based on these values the data can be read and written into an internal table. I use XSLT and XPath for that. So the inbound process is done and seems to work correctly. I have to mention that the file contains much more data than I need. I am working only with a small part of it.
    Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT? I can pass only the internal table to the transformation, so how do I access the XML file in order to update it? I have tried to use the <B>xsl:document()</B> function to access the content of the file store locally on my PC, but it fails each time by throwing and URI exception. I have tried the absolute path without any addition and the path with the file:/// addition. Same result. Please advise.
    Many thanks,
    Ferenc
    P.S. Please provide me with links only if they are relevant for this very matter. I will not give points for irrelevant postings...

    Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT?
    XSLT approach:  check these online tutorial
    http://www.xml.com/pub/a/2000/08/02/xslt/index.html
    http://www.xml.com/pub/a/2000/06/07/transforming/index.html
    ABAP approach:
    for example you have the xml (original) in a string called say xml_out .
    data: l_xml  type ref to cl_xml_document ,
            node type ref to if_ixml_node  .
    create object l_xml.
    call method l_xml->parse_string
      exporting
        stream = xml_out.
    node = l_xml->find_node(
        name   = 'IDENTITY'
       ROOT   = ROOT
    l_xml->set_attribute(
        name    = 'Name'
        value   = 'Charles'
        node    = node
    (the above example reads the element IDENTITY and sets attribute name/value to the same)
    like wise you can add new elements starting from IDENTITY using various methods available in class CL_XML_DOCUMENT
    so how do I access the XML file in order to update it?
    you have already read this XML into a ABAP variable right?
    Sorry couldnt understand your whole process, why do you need to read local XML file?
    Raja

  • Message transformation using XSLT

    Hi OSB Gurus,
    We are trying to implement following functionality using OSB.
    1. We have XML messages in a folder.
    2. Need to create a proxy service to take these messages and apply transformations using XSLT.
    3. After transformation, put the messages in a different folder which will be picked up by another message broker.
    Please give me some pointers about how i can design this. Also i would like to share my findings about the step 2, but having issues for defining input payload which should be defined in the step 1 above. I followed the document http://blog.jayway.com/2010/05/07/xslt-transformations-in-oracle-service-bus/ for registering the xslt transformation, but couldnot make it work as i am not sure about how i can integrate step 1 with step 2.
    Thanks so much in advance.

    Thanks for the suggestion. I will try and see. Here are the files:
    1. XML Input(Payload):
    <?xml version="1.0" encoding="UTF-8"?>
    <ODS>
         <LICENSE_TRANSACTION>
              <LIC_TRAN_ID>123</LIC_TRAN_ID>
              <LIC_CAMIS_ID>String</LIC_CAMIS_ID>
              <LIC_NBR>String</LIC_NBR>
              <LIC_STATUS_DATE>2000-01-01</LIC_STATUS_DATE>
              <LIC_ISSUE_DATE>2001-01-01</LIC_ISSUE_DATE>
              <LIC_EXP_DATE>2002-01-01</LIC_EXP_DATE>
              <LIC_INSP_REQ_FLAG>true</LIC_INSP_REQ_FLAG>
              <LIC_LAST_RENW_SNT_DATE>2003-01-01</LIC_LAST_RENW_SNT_DATE>
              <LIC_LAST_RENW_RCVD_DATE>2004-01-01</LIC_LAST_RENW_RCVD_DATE>
              <LIC_FED_TAX_ID>String</LIC_FED_TAX_ID>
              <LIC_NYS_TAX_ID>String</LIC_NYS_TAX_ID>
              <LIC_OPR_HRS_OPN_FROM>14:20:00</LIC_OPR_HRS_OPN_FROM>
              <LIC_OPR_HRS_OPN_TO>15:20:00</LIC_OPR_HRS_OPN_TO>
              <LIC_TEL_NBR>718-123-1234</LIC_TEL_NBR>
              <LIC_EMAIL_ID>String</LIC_EMAIL_ID>
              <LIC_FAX_NBR>718-123-1234</LIC_FAX_NBR>
              <LIC_NBR_OF_SEATS>10</LIC_NBR_OF_SEATS>
              <LIC_ENTITY_CREATE_DATE>2005-01-01</LIC_ENTITY_CREATE_DATE>
              <LIC_TRAN_CHG_DATE>2006-01-01</LIC_TRAN_CHG_DATE>
              <DETAIL>
                   <LICENSE>
                        <LIC_TYPE_CODE>String</LIC_TYPE_CODE>
                        <LIC_CAMIS_CODE>String</LIC_CAMIS_CODE>
                        <LIC_CAMIS_CLASS>String</LIC_CAMIS_CLASS>
                        <LIC_CAMIS_SUB_CLASS>String</LIC_CAMIS_SUB_CLASS>
                        <BUR_DESC>String</BUR_DESC>
                        <LIC_CODE_SHORT_DESC>String</LIC_CODE_SHORT_DESC>
                        <LIC_CODE_LONG_DESC>String</LIC_CODE_LONG_DESC>
                   </LICENSE>
              </DETAIL>
         </LICENSE_TRANSACTION>
         <STATUS>
              <STATUS_CAMIS_CODE>String</STATUS_CAMIS_CODE>
              <STATUS_SHORT_DESC>String</STATUS_SHORT_DESC>
              <STATUS_DESC>String</STATUS_DESC>
         </STATUS>
         <PREMISES_ADDRESS>
              <ADDR_BLDG_NBR>String</ADDR_BLDG_NBR>
              <ADDR_STREET>String</ADDR_STREET>
              <ADDR_LOCATION>String</ADDR_LOCATION>
              <BOROUGH_DESC>Queens</BOROUGH_DESC>
              <ADDR_CITY>String</ADDR_CITY>
              <ADDR_STATE>String</ADDR_STATE>
              <ADDR_ZIP_CODE>String</ADDR_ZIP_CODE>
              <ADDR_HEALTH_AREA>String</ADDR_HEALTH_AREA>
              <ADDR_HEALTH_CTR_DIST>String</ADDR_HEALTH_CTR_DIST>
              <ADDR_COMMUNITY_DIST>String</ADDR_COMMUNITY_DIST>
              <ADDR_BIN>String</ADDR_BIN>
              <ADDR_BLOCK_NBR>String</ADDR_BLOCK_NBR>
              <ADDR_LOT_NBR>String</ADDR_LOT_NBR>
              <ADDR_ASMBLY_DIST>String</ADDR_ASMBLY_DIST>
              <ADDR_CONGS_DIST>String</ADDR_CONGS_DIST>
              <ADDR_ST_SEN_DIST>String</ADDR_ST_SEN_DIST>
              <ADDR_CTY_COUN_DIST>String</ADDR_CTY_COUN_DIST>
              <ADDR_XCOORDINATE>123</ADDR_XCOORDINATE>
              <ADDR_YCOORDINATE>1234</ADDR_YCOORDINATE>
              <DATEOFBUILDINGBUILT>2010-08-11</DATEOFBUILDINGBUILT>
              <SCHOOLAREA>String</SCHOOLAREA>
              <POLICE>String</POLICE>
              <FIRE>String</FIRE>
              <LOWCROSSSTREET>String</LOWCROSSSTREET>
              <HIGHCROSSSTREET>String</HIGHCROSSSTREET>
              <ISPARK>false</ISPARK>
         </PREMISES_ADDRESS>
         <MAILING_ADDRESS>
              <ADDR_BLDG_NBR>String</ADDR_BLDG_NBR>
              <ADDR_STREET>String</ADDR_STREET>
              <ADDR_LOCATION>String</ADDR_LOCATION>
              <BOROUGH_DESC>Queens</BOROUGH_DESC>
              <ADDR_CITY>String</ADDR_CITY>
              <ADDR_STATE>String</ADDR_STATE>
              <ADDR_ZIP_CODE>String</ADDR_ZIP_CODE>
         </MAILING_ADDRESS>
         <BUSINESS>
              <BUS_TYPE_SHORT_DESC>String</BUS_TYPE_SHORT_DESC>
              <BUS_TYPE_LONG_DESC>String</BUS_TYPE_LONG_DESC>
              <BUS_ID>String</BUS_ID>
              <BUS_TRADE_NAME>String</BUS_TRADE_NAME>
              <BUS_CORP_NAME>String</BUS_CORP_NAME>
              <SITE_TYPE>String</SITE_TYPE>
              <DESCRIPTION>String</DESCRIPTION>
              <WEBSITE>String</WEBSITE>
              <AGE_RANGE>String</AGE_RANGE>
              <BUSINESS_PRINCIPAL>
                   <PRINCIPAL>
                        <BUS_PRNC_CAMIS_ID>124</BUS_PRNC_CAMIS_ID>
                        <BUS_PRNC_TITLE>String1</BUS_PRNC_TITLE>
                        <BUS_PRNC_FULL_NAME>String1</BUS_PRNC_FULL_NAME>
                        <BUS_PRNC_FNAME>String1</BUS_PRNC_FNAME>
                        <BUS_PRNC_LNAME>String1</BUS_PRNC_LNAME>
                        <BUS_PRNC_MNAME>String1</BUS_PRNC_MNAME>
                        <BUS_PRNC_DOB>2004-01-01</BUS_PRNC_DOB>
                        <HOMEPHONE>718-123-1234</HOMEPHONE>
                        <WORKPHONE>718-123-1234</WORKPHONE>
                        <FAX>718-123-1234</FAX>
                        <EMAIL>String1</EMAIL>
                        <CELLPHONE>718-123-1234</CELLPHONE>
                        <NOTES>String1</NOTES>
                        <STARTDATE>2004-01-01</STARTDATE>
                        <ENDDATE>2004-01-01</ENDDATE>
                        <ADDRESS>
                             <ADDR_BLDG_NBR>String1</ADDR_BLDG_NBR>
                             <ADDR_STREET>String1</ADDR_STREET>
                             <ADDR_LOCATION>String1</ADDR_LOCATION>
                             <BOROUGH_DESC>Queens</BOROUGH_DESC>
                             <ADDR_CITY>String1</ADDR_CITY>
                             <ADDR_STATE>String1</ADDR_STATE>
                             <ADDR_ZIP_CODE>String1</ADDR_ZIP_CODE>
                        </ADDRESS>
                   </PRINCIPAL>
                   <PRINCIPAL>
                        <BUS_PRNC_CAMIS_ID>123</BUS_PRNC_CAMIS_ID>
                        <BUS_PRNC_TITLE>String2</BUS_PRNC_TITLE>
                        <BUS_PRNC_FULL_NAME>String2</BUS_PRNC_FULL_NAME>
                        <BUS_PRNC_FNAME>String2</BUS_PRNC_FNAME>
                        <BUS_PRNC_LNAME>String2</BUS_PRNC_LNAME>
                        <BUS_PRNC_MNAME>String2</BUS_PRNC_MNAME>
                        <BUS_PRNC_DOB>2004-01-01</BUS_PRNC_DOB>
                        <HOMEPHONE>718-123-1234</HOMEPHONE>
                        <WORKPHONE>718-123-1234</WORKPHONE>
                        <FAX>718-123-1234</FAX>
                        <EMAIL>String2</EMAIL>
                        <CELLPHONE>718-123-1234</CELLPHONE>
                        <NOTES>String2</NOTES>
                        <STARTDATE>2004-01-01</STARTDATE>
                        <ENDDATE>2004-01-01</ENDDATE>
                        <ADDRESS>
                             <ADDR_BLDG_NBR>String2</ADDR_BLDG_NBR>
                             <ADDR_STREET>String2</ADDR_STREET>
                             <ADDR_LOCATION>String2</ADDR_LOCATION>
                             <BOROUGH_DESC>Queens</BOROUGH_DESC>
                             <ADDR_CITY>String2</ADDR_CITY>
                             <ADDR_STATE>String2</ADDR_STATE>
                             <ADDR_ZIP_CODE>String2</ADDR_ZIP_CODE>
                        </ADDRESS>
                   </PRINCIPAL>
              </BUSINESS_PRINCIPAL>
              <BUSINESS_INSURANCE>
                   <BUS_WRK_CMP_CARRIER>String</BUS_WRK_CMP_CARRIER>
                   <BUS_WRK_CMP_POLICY_NBR>String</BUS_WRK_CMP_POLICY_NBR>
                   <BUS_WRK_CMP_EXP_DATE>2004-01-01</BUS_WRK_CMP_EXP_DATE>
                   <BUS_DISB_INSU_CARRIER>String</BUS_DISB_INSU_CARRIER>
                   <BUS_DISB_INSU_PLCY_NBR>String</BUS_DISB_INSU_PLCY_NBR>
                   <BUS_DISB_INSU_PLCY_EXP_DATE>2004-01-01</BUS_DISB_INSU_PLCY_EXP_DATE>
              </BUSINESS_INSURANCE>
         </BUSINESS>
         <RECEIPT>
              <RCPT_PAYOR_NAME>String</RCPT_PAYOR_NAME>
              <RCPT_CASH_FLG>true</RCPT_CASH_FLG>
              <RCPT_REMIT_AMT>123</RCPT_REMIT_AMT>
              <RCPT_APLY_AMT>123.50</RCPT_APLY_AMT>
              <RECEIPT_DETAILS>
                   <RCPT_DET_PMT_AMT>123.51</RCPT_DET_PMT_AMT>
                   <RCPT_DET_PMT_DATE>2004-01-01</RCPT_DET_PMT_DATE>
                   <RCPT_DET_PMT_TIME>20:15:00</RCPT_DET_PMT_TIME>
                   <RCPT_DET_PMT_CHK_NBR>1111</RCPT_DET_PMT_CHK_NBR>
              </RECEIPT_DETAILS>
              <RECEIPT_DETAILS>
                   <RCPT_DET_PMT_AMT>23.50</RCPT_DET_PMT_AMT>
                   <RCPT_DET_PMT_DATE>2004-01-01</RCPT_DET_PMT_DATE>
                   <RCPT_DET_PMT_TIME>20:15:11</RCPT_DET_PMT_TIME>
                   <RCPT_DET_PMT_CHK_NBR>22222</RCPT_DET_PMT_CHK_NBR>
              </RECEIPT_DETAILS>
         </RECEIPT>
    </ODS>
    I will post remaining XSLT and output in my next posts.
    Thanks for your help.

  • Upload XML data using XSQL and HTTP Post ?

    Upload XML data using XSLQ and HTTP Post: is that possible ?
    An xsql contains an <xsql:insert-request table="aTable">
    The XML data file follows the ROWSET/ROW paradigm.
    What is the HTML form to upload the xml file to the XSQL ?
    I tried:
    <form action="myXSQL.xsql" method="POST" ENCTYPE="multipart/form-data">
    XML data file to upload: <input type="file">
    <input type="submit">
    </form>
    But the answer of myXSQL is:
    <xsql-status action="xsql:insert-request" result="No posted document to process" />
    Where is the problem ?
    Thank you.

    Hello,
    You are posting your XML file as a parameter therefore you should use the <xsql:insert-params/> tag, not the <xsql:insert-request/>. The insert-request can only handle data not posted via a parameter.
    Usage:
    <form action="myXSQL.xsql" method="GET" ENCTYPE="multipart/form-data">
    XML data file to upload: <input type="file" name="myXML">
    <input type="submit">
    </form>
    in combination with
    <xsql>
    <xsql:insert-params name="myXML" table="your table"/>
    </xsql>
    2 remarks:
    I was not able to succesfully POST the form. The answer was <xsql-status action="xsql:insert-request" result="No posted document to process" />. With GET is was succesfull.
    Second, if you use MSInternet explorer 5 or higher use could post the XML directly (not aw parameter) using an ActiveX object.
    Regards,
    Harm Verschuren

  • Query on sorting  XML using XSLT and getting the same XML as output !

    Hi,
    Looking for one information regarding sorting XML using XSLT , with the sorted XML as output. For eg. my XML is :
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
    <levelone>
         <child ID="1" sort="5">
              <name>Paul</name>
         </child>
         <child ID="2" sort="1">
              <name>Adam</name>
         </child>
         <child ID="3" sort="2">
              <name>Will</name>
         </child>
    </levelone>
    and XSL :
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/levelone">
         <xsl:copy>
         <xsl:apply-templates>
              <xsl:sort select="@sort"/>
         </xsl:apply-templates>
              </xsl:copy>
         </xsl:template>
         <xsl:template match="child">
              <xsl:copy-of select="."/>
         </xsl:template>
    </xsl:stylesheet>
    This does the sort based on Name. But I want to get the same xml as output with the name sorted. Eg.
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
    <levelone>
         <child ID="2" sort="1">
              <name>Adam</name>
         </child>
         <child ID="1" sort="5">
              <name>Paul</name>
         </child>
         <child ID="3" sort="2">
              <name>Will</name>
         </child>
    </levelone>
    Any pointers will be highly appreciated.
    - Thanks

    Don't you want <xsl:sort select="name"/> rather than <xsl:sort select="@sort"/>?

  • How to use OAF transform sotred xml documents using XSLT...

    Does anyone have any experience using XSLT in OAF? Specifically, I have xml documents stored in a clob to which I wish to apply an XSLT transformation and then store the transformed documents back into the clob. Is there a way to apply an XSLT transformation using say BI-Publisher via OAF?

    "XML DIFF" are the keywords you can use to search for products that do this. Last time I looked there was a lot of XML Diff implementations, but none of them produced human-readable output that I really liked. I expect that's because XML diff is an easy thing for people to ask for but not an easy thing to do, given the considerable number of ways there are to change a document.

  • String to XML conversion using XSLT

    Hi all,
    I have a scenario when my source input XML is in the form of a string which needs to be transformed into an XML target fields.
    I am using XSLT mapping to do that and its working but unfortunately, input XML contain xml declaration <?xml version='1.0'?>. Because of which it fails.
    I need to remove this. Can any body please suggest how to do this?
    Any help will be appriciated.
    Regards
    -Kulwant

    Hi,
    Refer these links
    XI/PI: Convert Flat File to Deeply Nested XML Structures Using Only Graphical Mapping
    Regards,
    Surya

  • How to do 2:1 transformation using XSLT in ccBPM?

    Hi,
    We have the following ccBPM defined:
          A    A    B   A/C   D    E    F
    Start---R1---T1---S2---T2---S3---T3---S1---END
    R1: Receives Synch XML message A via plain HTTP adapter and opens S/A bridge.
    T1: Transforms A into message B using XSLT
    S2: Sends message B to a legacy system to do a lookup and gets response C
    T2: Transforms A and C into D.
    S3: Sends D to another legacy system synchronously and gets response E.
    T3: Transforms E to the final response format F
    S1: Sends F to the original requestor and close the S/A bridge.
    We had created an XSLT style sheet which takes into
    consideration of multi-mapping message structure (e.g.
    ns0:Messages/ns0:Message1/A and Messages/Message2/C...)
    For some reason, the integration process always fails at
    Step T2. The only error message we got is:
    <b>
    Incorrect XML format after mapping: Message expected instead of Catalog
    </b>
    We went thru all the monitoring/trace tool and could not find any more info on the issue.
    I'd really appreciate it if someone can explain the required steps
    for designing and configuring n:1 XSLT  transformation step.
    Thanks in advance
    -Simon

    Hi Duke,
    I still couldn't get it to work. I compared my xsl file
    with yours and they look similar. I was able to turn on the
    DefaultTrace. The trace log indicated the mapping call was
    successful. But no output was generated. No error message
    either. Supposedly XI combines two input xml messsages into 
    a single message to feed into the XSLT, is there away to
    trace out this single input message?
    Also do two input messages need to be correlated?
    thanks again for your help
    -Simon

  • Character encoding problem using XSLT and Tomcat on Linux

    Hi,
    I have an application running on a Tomcat 4.1.18 application server that applies XSLT transformations to DOM objects using standard calls to javax.xml.transform API. The JDK is J2SE 1.4.1_01.
    It is all OK while running on a development enviroment (which is Windows NT 4.0 work station), but when I put it in the production enviroment (which is a red hat linux 8.0), it comes up with some kind of encoding problem: the extended characters (in spanish) are not shown as they should.
    The XSL stylesheets are using the ISO-8859-1 encoding, but I have also tried with UTF-8.
    These stylesheets are dynamicly generated from a JSP:
    // opens a connection to a JSP that generates the XSL
    URLConnection urlConn = (new URL( xxxxxx )).openConnection();
    Reader readerJsp = new BufferedReader(new InputStreamReader( urlConn.getInputStream() ));
    // Gets the object that represents the XSL
    Templates translet = tFactory.newTemplates( new StreamSource( readerJsp ));
    Transformer transformer = translet.newTransformer();
    // applies transformations
    // the output is sent to the HttpServletResponse's outputStream object
    transformer.transform(myDOMObject, new StreamResult(response.getOutputStream()) );Any help would be appreciated.

    Probably you need to set your LANG OS especific environment variable to spanish.
    Try adding this line:
    export LANG=es_ES
    to your tomcat/bin/catalina.sh, and restart tomcat.
    It should look like this:
    # OS specific support.  $var _must_ be set to either true or false.
    cygwin=false
    case "`uname`" in
    CYGWIN*) cygwin=true;;
    esac
    export LANG=es_ES
    # resolve links - $0 may be a softlink
    PRG="$0"
    .(BTW, keep using ISO-8859-1 encoding for your XSL)
    HTH
    Un Saludo!

  • XML transform using XSL

    Hi,
    I am new to the javax technology.
    I have a xml that has data in this format
    <?xml version="1.0" encoding="UTF-8"?>
    <emps>
    <emp>
    <empName>Me</empName>
    <empAge>23</empAge>
    </emp>
    <emp>
    <empName>You</empName>
    <empAge>23</empAge>
    </emp>
    </emps>Can i convert this to an XML that has tags and data like
    <employees>
    <employee>
    <name>me</name>
    <age>23</age>
    </employee>
    <employee>
    <name>you</name>
    <age>23</age>
    </employee>
    </employees>using a XSLT?
    thanks,
    Dilip

    So the only change is changing the element names? Sure you can. Or at least I can. Here's a template that changes an emps element into an employees element and preserves its children:<xsl:template match="emps">
    <employees><xsl:apply-templates/></employees>
    </xsl:template>Use an identity transformation and put in one of these for each element whose name you want to change.

  • How to add a textline to an xml structure using xslt

    Hi,
    I am having a requirement where i need to add a textline to an xml.
    scenario: IDOC-File  and output format is an xml.
    Output should be like this:
    &&##AOC0MB000#AD15543390#BOIFCO#Z
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <messages>
         <batch>0800062844</batch>
         <message>
              <type>VPR</type>
              <action>A</action>
              </body>
         </message>
    </messages>
    The line that has been added to xml is the data that will be coming from IDOC. How can we append the textline to the xml using xslt.Will document() in xslt works for doing this?

    The required format in ur scenario is not an xml format, so u should not save the file in xml format. U may write an adapter module at receiver to achieve this.
    How can we append the textline to the xml using xslt
    This is not possible as the output of xsl transformation is an xml file.
    Regards,
    Prateek

Maybe you are looking for

  • GR/IR clearing per valuation class

    Hey all, I was trying to post the GR/IR clearing account per valuation class, so i changed the rule in OBYC in WRX to be per valuation class and account modifier, i entered the correct combination (WRX + VBR + V.Class + G/L a/c) but it's not picking

  • Query Template Caching Properties

    I need to change the IsCachable on the fly in an IRPT page. It seems every property is exposed in the query object EXCEPT IsCachable. Am I missing something? Assuming I'm not, how can I simply tell the query template to NOT check the cache for this u

  • Row and column headings-how to print without them

    Currently Epson C64 and appleworks 6.2 How can I print the spreadsheet without the row and column headings as there doesnt seem to be a place to choose whether to how or not Thanks for replies Whilst writing, too many instances of the coloured wheel

  • NAT type moderate all of a sudden

    Been online gaming for some time.  Playing Modern Warfare 3 on PC and noticed that my NAT type was moderate.  It was Open as recently as yesterday.  Double checked my router settings and my PC is still in a DMZ.  Re-booted the router but still have a

  • Missing Smart Collection Filter?

    I've tried: - Opening other smart collections - Opening other events and other smart collections - Opening other projects, events, and other smart collections - Restarting the application - Restarting computer - Reinstalling the application