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.

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 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:
    &#160;- requesting some xml files -> XMLTransformerServlet is invoked and works fine:
    &#160;&#160;&#160;-> doGet checks the resource (if resource doesn't exist HTTP404 will be responded)
    &#160;&#160;&#160;-> doGet checks the caching state for this resource
    &#160;&#160;&#160;&#160;&#160;&#160;a) resource is in cache and no newer version of the File exists -> return cached element
    &#160;&#160;&#160;&#160;&#160;&#160;b) resource is in cache but a newer version exists in the file system -> recache and return newly cached element
    &#160;&#160;&#160;&#160;&#160;&#160;c) resource is not in cache -> cache the resource and return the newly cached element
    &#160;- requesting one of the other servlets (those that use xml transformation for menu generation)
    &#160;&#160;&#160;-> servlets invoked work fine
    &#160;- requesting a xml file:
    &#160;&#160;&#160;a) current version in cache -> return cached element
    &#160;&#160;&#160;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...

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

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

  • Open XML and using xslt with JavaScript

    Hello,
    I want the user to be able to choose an XML-file. This XML-file should not be placed in InDesign, there is not even a document needed for my script. All I need is a variable, containing the file. However, the XML-file should be transformed with xslt into another XML-file. How do I do this?
    This is how I open the first XML-file, the one that should be transformed:
       var xmlDoc = File.openDialog ("Choose XML");
       if (xmlDoc == null) {return;}
        xmlDoc.open("r");
        xmlDoc = xmlDoc.read();
        xmlDoc = new XML(xmlDoc);
    I can adress different nodes and use xmlDoc as an XML-file, so that's fine, but how do I transform it?
    I read the Scripting Guide and tried this:
        var myDocument = app.documents.add();
        var myXMLImportPreferences = app.xmlImportPreferences;
        myXMLImportPreferences.transformFilename = "c:\myTransform.xsl";
        var xx = myDocument.importXML(File.openDialog ("XML"));
    However, it's not exactly what I want since I have to create a document and it's not working either, since xx stays undefined.
    Thanks for your help.

    You can't get exactly what you want.
    Your first code example uses the InDesign JavaScript interpreter's XML support, called E4X. It has absolutely nothing to do with the InDesign document object model or InDesign's internal support for XML. It exists only within the JavaScript interpreter. It does not support XSLT transformations.
    Your second example leverages InDesign's built-in XSLT support (I'm not too sure how this works...); but that is only useful when importing XML into
    InDesign, which, as you have learned, requires a document.
    In the first example, you could call out to an external invokation of xsltproc and read in the input. How to do that differs for Windows and Mac.
    In the second example, you could export the XML from your Document back out to an XML file and read it back in with E4X.
    None of this is very appealing. What do you really need to do?

  • 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

  • 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

  • PLS HELP: XML Transformation using Saxon8

    I am using XSL version2.0 and the xalan parser is not recognizing the tokenize function in the XSLT.
    Now I am trying to transform the XML using Saxon8. But it is giving exception...
    java.lang.ClassNotFoundException ---> java.lang.AssertionError.
    at java.lang.Class.forName(Class.java:142)
    at net.sf.saxon.functions.ExtensionFunctionFactory.class$(ExtensionFunctionFactory.java:21)
    at net.sf.saxon.functions.ExtensionFunctionFactory.<init>(ExtensionFunctionFactory.java:21)
    at net.sf.saxon.Configuration.<init>(Configuration.java:87)
    at net.at net.sf.saxon.TransformerFactoryImpl.<init>(TransformerFactoryImpl.java:44)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:262)
    at javax.xml.transform.FactoryFinder.newInstance(Unknown Source)
    at javax.xml.transform.FactoryFinder.find(Unknown Source)
    at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
    at SAXTest.main(SAXTest.java:
    the following is the code...
    Please help in solving the problem...
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import java.io.*;
    import net.sf.saxon.*;
    public class SAXTest {
    public static void main(String[] args) {
    String strResult = new String();
    File xmlFile = new File("source.xml");
    File xslFile = new File("input.xsl");
    System.setProperty"javax.xml.transform.TransformerFactory","net.sf.saxon.TransformerFactoryImpl");
    StringWriter xmlString = new StringWriter();
    StreamSource xmlSource = new StreamSource(xmlFile);
    StreamSource xslSource = new StreamSource(xslFile);
    StreamResult result = new StreamResult(xmlString);
    TransformerFactory trans = TransformerFactory.newInstance();
    try
    Transformer transformer = trans.newTransforme(xslSource) transformer.transform(xmlSource,result);
    System.out.println("result = "+result.toString());
    }catch(Exception e){}
    Please help me....

    It depends on your jre version if you have jre 1.4 .
    You can get your TransformerFactory instance using javax.xml.transform.TranformerFactory.newInstance() directrly.
    If your jre version is higher than *1.4* than try to locate this class in your rt.jar in jre lib directory.
    When you found that class replace your code
    System.setProperty("javax.xml.transform.TransformerFactory","your desired TransformerFactoryClass") than run the code you wont find that error again.
    If you want some details copy and paste your error in google search you will found same problems posted by different programmers on forums however i have seen them before. Hope this help. Sorry if i have misunderstood your problem.

  • How to Convert the following XML? using XSLT Mapper?

    Hey all,
    I have a simple looking but complex problem
    I have a XML file like this
    <userdata>
    <city> new york</city>
    <address>San Fransico </address>
    </userdata>
    My result XML should look like this
    <UserDetails>
    <Details>
    <id>1234</id>
    <place>new york</place>
    </Details>
    <Details>
    <id>42345</id>
    <place>San Fransico </place>
    </Details>
    </UserDetails>
    I tried things but they never worked.
    Any help regarding this will be of great helpppppppppppppppppppppppppp!!
    Thanks in advance
    -Murthy.

    You can use XSLT. Between, where do you want to get the ID values of the place tag in result xml.
    --Shiv                                                                                                                                                                                                                       

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

  • Splitting xml message using XSLT

    Hi,
    I have XML message that I want to split up using XSLT. Following is the structure of the XML message.
    <Meters>
    <Meter>
    <ID>1</ID>
    <Type>A</Type>
    <Reading ref="1A" />
    </Meter>
    <Meter>
    <ID>2</ID>
    <Type>A</Type>
    <Reading ref="2A" />
    </Meter>
    <Meter>
    <ID>3</ID>
    <Type>B</Type>
    <Reading ref="3B" />
    </Meter>
    <Reading>
    <refLink>1A</refLink>
    <quantity>Watts</quantity>
    <value>221.00</value>
    </Reading>
    <Reading>
    <refLink>2A</refLink>
    <quantity>Wh d</quantity>
    <value>0.00</value>
    </Reading>
    <Reading>
    <refLink>3B</refLink>
    <quantity>Wh r</quantity>
    <value>3.00</value>
    </Reading>
    </Meters>
    The split up should happen on the <Meter> tag. Currently, this message has three <Meter> elements. The output should result in 3 different XML messages each having its own <Meter> element. Also, please note that each <Meter> has <Reading> which is linked to the actual <Reading> data using "ref" attribute and "refLink". The value of "ref" attribute will be unique through out the XML message.
    Expected output: 1.xml
    <Meters>
    <Meter>
    <ID>1</ID>
    <Type>A</Type>
    <Reading ref="1A" />
    </Meter>
    <Reading>
    <refLink>1A</refLink>
    <quantity>Watts</quantity>
    <value>221.00</value>
    </Reading>
    </Meters>
    and similarly 2 more XMLs.
    Please let me know if anyone has done this kind of work in XSLT.

    You are right I see that xsl:document is in 1.1 recommendation, but was referred by
    XSLT books I have.
    I found one site that's explaining this
    http://www.vbxml.com/xsl/elmxsl_document.asp
    http://www.w3.org/TR/xslt11/#multiple-output
    I am almost trying now to reverting to using java.util.regex and doing the split
    brutforce.. :))))
    - Ravi

  • Need to remove first UsernameToken header on XML document using XSLT

    Can someone help me with an XSLT transformation where i want to remove the first wsse:Security header from my request message. I am not an XSLT expert, so i started playing around with XSLT code but no luck yet.
    My input message Before transformation
    <soapenv:Envelope xmlns:acc="http://wsdl/AccountManagerDocLiteralWrapped/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header>
       <wsse:Security soapenv:actor="actor1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsse:UsernameToken wsu:Id="UsernameToken-1436F53E829718B6F31400871123845250">
       <wsse:Username>user1</wsse:Username>
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
       <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TAOptcRrjG0vM85BrdbhPw==</wsse:Nonce>
       <wsu:Created>2014-05-23T18:52:03.845Z</wsu:Created>
       </wsse:UsernameToken>
       </wsse:Security>
       <wsse:Security soapenv:actor="actor2" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsse:UsernameToken wsu:Id="UsernameToken-1436F53E829718B6F31400871123845250">
       <wsse:Username>user2</wsse:Username>
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
       <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TAOptcRrjG0vM85BrdbhPw==</wsse:Nonce>
       <wsu:Created>2014-05-23T18:52:03.845Z</wsu:Created>
       </wsse:UsernameToken>
       </wsse:Security>
       </soapenv:Header>
       <soapenv:Body>
          <acc:transfer>
             <acc:acctFrom>AC1</acc:acctFrom>
             <acc:acctTo>AC2</acc:acctTo>
             <acc:amount>9</acc:amount>
          </acc:transfer>
       </soapenv:Body>
    </soapenv:Envelope>
    Expected Output after Transformation
    <soapenv:Envelope xmlns:acc="http://wsdl/AccountManagerDocLiteralWrapped/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header>
       <wsse:Security soapenv:actor="actor2" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsse:UsernameToken wsu:Id="UsernameToken-1436F53E829718B6F31400871123845250">
       <wsse:Username>user2</wsse:Username>
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
       <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TAOptcRrjG0vM85BrdbhPw==</wsse:Nonce>
       <wsu:Created>2014-05-23T18:52:03.845Z</wsu:Created>
       </wsse:UsernameToken>
       </wsse:Security>
       </soapenv:Header>
       <soapenv:Body>
          <acc:transfer>
             <acc:acctFrom>AC1</acc:acctFrom>
             <acc:acctTo>AC2</acc:acctTo>
             <acc:amount>9</acc:amount>
          </acc:transfer>
       </soapenv:Body>
    </soapenv:Envelope>
    Appreciate any help with this.
    - dk

    Hi Deepthi,
    Please give the following snippet a try, it should ignore the first occurence of wsse:Security for the output (the first template is used to copy everything into the output, the second template is overruling the first template for the first occurence of wsse:Security and creates an empty output for it):
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <xsl:output omit-xml-declaration="yes"/>
        <xsl:template match="node()|@*">
          <xsl:copy>
             <xsl:apply-templates select="node()|@*"/>
          </xsl:copy>
        </xsl:template>
        <xsl:template match="wsse:Security[1]"/>
    </xsl:stylesheet>

Maybe you are looking for