Convert XML Node to String using XSLT

Hi,
Perhaps this has been discussed before. But i am looking at creating a XSLT mapping to take the entire inbound message and put it into a single node of the target.
Is there a way?
Thanks in advance
Regards
Venkat

Hi Shankar,
I have a input XML <root><a></a></root>
I have a target <tgt><b></b></tgt>
I need to have the target xml as
<tgt><b>&lessthansign;root&greaterthansign;&lessthansign;a&greaterthansign;&lessthansign;/a&greaterthansign;&lessthansign;/root&greaterthansign;</b></tgt>
Using the XSLT that you mentioned
I am getting the format
<tgt><b><root><a></a></root></b></tgt>
Now the consumer of this message expects the data in the first type of format
That is where i am getting stuck
Thanks and Regards
Venkat

Similar Messages

  • Convertion of XML node to string using Xquery transformation in OSB

    How to convert XML node to string using a built in function using Xquery transformation in OSB? In BPEL we have the Xpath extension function ora:getContentAsString() to do the same.

    fn:bea-serialize() function converts xml node to string. but it assigns namespace prefix in every xml node during the conversion. So is there any function to remove the namespace prefix from XML node using Xquery built in function?

  • Problem in transforming XML to string using XSLT

    Hi there,
    I have a R/3 -> XI -> WebService scenario where the message from XI to webservice needs to be sent in document/wrapped mode (the message xml must be embedded in a string element) and this message needs to be digitally signed.
    We are using another webservice to sign the messages, also with the message being sent in a string. To transform the XML's into string and vice-versa, we are using XSLT (/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping).
    The problem is that both the signer and the final webservice understand the special characters (like '<', '>', '&', '"' etc) in one way but the XSLT generates them in another way. For example, the character '<', in both webservices, is returned as "&#60;" but the XSL Transformation results in "&lt;".
    The problem now is that our messages are always being rejected because the signature is not being recognized as true, though we are almost 100% sure that it's being done correctly. The only possibility to the error that we found is this character mapping being done differently.
    So, it's like this:
    XI sends string to signer as "&lt;"
    XI receives string from signer as "&#60;"
    XI processes the message
    XI sends string to webservice as "&lt;"
    XI receives string from webservice (containing error message) as "&#60;"
    Is there a way of making the XSLT to return "&#60;" instead of "&lt;"?
    Thanks in advace,
    Henrique.

    For Java Mapping, you can refer this-
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    In Java Mapping, in the startdocument event , you need to check for the specialchars, and just repalce the value required.
    But, what i am thinking is , just try with Java functions inside the XSLT mapping instead of going for Java Mapping. You can call java functions from the XSLT. So before the document starts pasring, you need to replace the special characters. I did not try in XSLT like this.
    For this , you can think with this e.g
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    Regards,
    Moorthy

  • How to get the WHOLE xml document inside a string using XSLT mapping

    Hi folks,
    I have a deep xml structure that I want to embed as body, tags included, in a mail message (not as an attachment).
    I'm trying to use Michal's method in this blog
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    However, I can't get it to deliver the entire structure instead of just specific elements.
    Any help is greatly appreciated,
    Thanks,
    Guy

    Ashok,
    I was able to work it out for my case.
    This XSL......
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <inside>
    <namestring>
    <xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>
    <xsl:copy-of select="outside/name/*"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text>
    <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
    </namestring>
    </inside>
    </xsl:template>
    </xsl:stylesheet>
    ...will transform this input....
    <?xml version="1.0" encoding="UTF-8"?>
    <outside>
    <name>
    <nameone>name1</nameone>
    <nametwo>name2</nametwo>
    <namethree>name3</namethree>
    </name>
    </outside>
    ...and put the whole lot into the CDATA element.
    Hope this helps you,
    Guy

  • XML to Internal table using XSLT by CALL TRANSFORMATION error

    Dear experts,
    I have to fetch the data from an XML file using XSLT into internal tables. The XML file is very big as following:-
    <?xml version="1.0" standalone="yes" ?>
    - <Shipment>
      <shipmentID>25091203S000778</shipmentID>
      <manifestDateTime>2009-12-03T20:16:52.00</manifestDateTime>
      <shipmentFacilityNumber>025</shipmentFacilityNumber>
      <shipmentFacilityAbbreviation>CHI</shipmentFacilityAbbreviation>
      <shipmentFacilityAddress1>810 KIMBERLY DRIVE</shipmentFacilityAddress1>
      <shipmentFacilityAddress2 />
      <shipmentFacilityCity>CAROL STREAM</shipmentFacilityCity>
      <shipmentFacilityState>IL</shipmentFacilityState>
      <shipmentFacilityPostalCode>601880000</shipmentFacilityPostalCode>
      <shipmentTruckCarrierCode>X150</shipmentTruckCarrierCode>
      <shipmentSourceCode>T</shipmentSourceCode>
      <userID>CAMPOSG</userID>
    - <Delivery>
      <primaryCustomerNumber>954371</primaryCustomerNumber>
      <primaryCustomerName>MIDWEST OFFICE SUPPLY</primaryCustomerName>
      <primaryCustomerAddress1 />
      <primaryCustomerAddress2>4765 INDUSTRIAL DR</primaryCustomerAddress2>
      <primaryCustomerCity>SPRINGFIELD</primaryCustomerCity>
      <primaryCustomerState>IL</primaryCustomerState>
      <primaryCustomerPostalCode>627030000</primaryCustomerPostalCode>
      <primaryCustomerPhoneNumber>2177535555</primaryCustomerPhoneNumber>
      <shuttleStopFacilityNumber />
      <billOfLadingNumber>25HZK99</billOfLadingNumber>
      <carrierProNumber />
      <shipmentTotalCartonCount>6</shipmentTotalCartonCount>
      <shipmentTotalWeight>266</shipmentTotalWeight>
    - <order>
      <orderNumber>25HZK99</orderNumber>
      <subOrderNumber />
      <dateProcessed>2009-12-03</dateProcessed>
      <primaryOrderNumber />
      <shipTruckCode>X150</shipTruckCode>
      <shipTruckDescription>UDS - ADDISON</shipTruckDescription>
      <shipTruckPriorityCode>01</shipTruckPriorityCode>
      <shipTruckGroupCode>01</shipTruckGroupCode>
      <shipTruckDepartureTime>20.00.00</shipTruckDepartureTime>
      <shipTruckDockID>07</shipTruckDockID>
      <ldpFacilityAbbreviation />
      <shuttleAvailableIndicator>N</shuttleAvailableIndicator>
      <shuttleMessageText />
      <crossDockFacilityCode />
      <crossDockTruckCode />
      <crossDockID />
      <subsidizedFreightTruckID />
      <customerPurchaseOrderNumber>623559</customerPurchaseOrderNumber>
      <headerTypeCode>P</headerTypeCode>
      <orderTypeID>RG</orderTypeID>
      <deliveryTypeID>DS</deliveryTypeID>
      <deliveryMethodCode />
      <customerBarCode />
      <customerReferenceData>25HZK99</customerReferenceData>
      <customerReferenceText />
      <customerRouteData>ZNED UNTED</customerRouteData>
      <customerRouteText>ROUTE</customerRouteText>
      <endConsumerPurchaseOrderNumber />
      <endConsumerPurchaseOrderText />
      <endConsumerName>CHARLESTON TRANS. FACILITY</endConsumerName>
      <endConsumerAddress1>HOMEWOOD DT PROGRAM DEPT. 3</endConsumerAddress1>
      <endConsumerAddress2>17341 PALMER BLVD.</endConsumerAddress2>
      <endConsumerAddress3 />
      <endConsumerCity>HOMEWOOD</endConsumerCity>
      <endConsumerState>IL</endConsumerState>
      <endConsumerPostalCode>60430</endConsumerPostalCode>
      <endConsumerCountryCode />
      <fillFacilityNumber>025</fillFacilityNumber>
      <shpFacilityNumber>025</shpFacilityNumber>
      <homeFacilityAbbrCode>STL</homeFacilityAbbrCode>
      <homeFacilityNumber>015</homeFacilityNumber>
      <multiCartonIndicator>Y</multiCartonIndicator>
      <primaryCustomerIndicator>Y</primaryCustomerIndicator>
      <shipToCustomerNumber>954371001</shipToCustomerNumber>
      <customerCompanyID>01</customerCompanyID>
      <customerTruckID>U888</customerTruckID>
      <customerTruckDescription>UDS - ADDISON</customerTruckDescription>
      <customerTruckDockID>13</customerTruckDockID>
      <thirdPartyBillCarrier />
      <thirdPartyBillID />
      <thirdPartyBillType />
      <qualityCheckIndicator>N</qualityCheckIndicator>
      <warehouseLaydownID />
      <packListPosition>I</packListPosition>
      <preferredPackingType>CTN</preferredPackingType>
      <preferredPackingMaterial>PAPER</preferredPackingMaterial>
      <preferedPackingInstructions />
      <totalOrderCartonQty>6</totalOrderCartonQty>
      <convertAddressIndicator>N</convertAddressIndicator>
      <dealerInstructionIndicator>Y</dealerInstructionIndicator>
      <dealerinstructions1>CPO#: 623559</dealerinstructions1>
      <dealerinstructions2>ATTN: DANA GRIFFIN</dealerinstructions2>
      <dealerinstructions3>INFO: 612</dealerinstructions3>
      <dealerinstructions4>ROUTE: ZNED UNTED</dealerinstructions4>
      <dealerinstructions5 />
      <dealerinstructions6 />
      <shippingInstructionsIndicator>N</shippingInstructionsIndicator>
      <shippingInstructions1 />
      <shippingInstructions2 />
      <shippingInstructions3 />
      <shippingInstructions4 />
      <shippingInstructions5 />
      <shippingInstructions6 />
      <specialInstructionsIndicator>N</specialInstructionsIndicator>
      <specialInstructions1 />
      <specialInstructions2 />
      <customeContainerDesc />
    - <carton>
      <deliveryCartonID>253370905995</deliveryCartonID>
      <shipIndicator>Y</shipIndicator>
      <deliveryPalletID>X150</deliveryPalletID>
      <consolidatedDeliveryCartonID />
      <scanDateTime>2009-12-03T19:36:12.00</scanDateTime>
      <cartonWeight>52</cartonWeight>
      <dropShipFlag>1</dropShipFlag>
      <carrierTrackingNumber />
      <carrierZoneID>0</carrierZoneID>
      <codAmount />
      <customerPackageAmount />
      <declaredValue />
      <residentialDeliveryIndicator />
      <serviceTypeCode>00</serviceTypeCode>
      <ssccCode>006860244400829393</ssccCode>
    - <Item>
      <shipPrefix>UNV</shipPrefix>
      <shipStockNumber>21200</shipStockNumber>
      <itemDescription>PAPER XERO/DUP WE LTR 20#</itemDescription>
      <orderQuantity>1</orderQuantity>
      <originalShipQuantity>1</originalShipQuantity>
      <shipQuantity>1</shipQuantity>
      <inventoryUnitCode>CT</inventoryUnitCode>
      <inventoryWeightQuantity>52.000</inventoryWeightQuantity>
      <upcNumber>00000000000000</upcNumber>
      <upcRetailCode>087547212004</upcRetailCode>
      <hazmatIndicator>N</hazmatIndicator>
      <serialRequiredIndicator>N</serialRequiredIndicator>
      <dealerMemoPO>S</dealerMemoPO>
      <cartonLineNumber>1</cartonLineNumber>
      <orderLineNumber>11</orderLineNumber>
      <originalOrderPrefix>UNV</originalOrderPrefix>
      <originalOrderStockNumber>21200</originalOrderStockNumber>
      <reasonCode />
    - <Item_Serial>
      <serialNumber />
      </Item_Serial>
        </Item>
      </carton>
       </order>
      </Delivery>
      </Shipment>
    This is not the complete XML file as it exceeds the 15000 characters and then I cann't post here. So I have deleted much part of it.
    The hierarchy is as following: Shipment->Delivery->Order->Carton->Item.
    I have created a XSLT for it which is working fine.
    But when I execute my report program it gives CX_SY_XSLT_FORMAT_ERROR saying that
    Transformation error:  Non-canonical structure of element name XML_OUTPUT.

    Dear experts,
    My report program is as following:-
    *& Report  Z_ASNTRNS
    REPORT  Z_ASNTRNS.
    *& Report  Z_ASNTRNS
    TYPE-POOLS: abap, ixml.
    TABLES: ZASN_SHIPMENT,ZASN_DELIVERY,ZASN_ORDER,ZASN_CARTON,ZASN_ITEM.
    *CONSTANTS gs_file TYPE string VALUE 'C:Documents and SettingsC5134126DesktopRajesh_kandakatlaSampleASNFile.xml'.
    This is the structure for the data from the XML file
    TYPES: BEGIN OF ts_item,
          ZSHIPMENT LIKE ZASN_ITEM-ZSHIPMENT,
          VBELN LIKE ZASN_ITEM-VBELN,
          ORDER_NUMBER LIKE ZASN_ITEM-ORDER_NUMBER,
          CARTON_ID LIKE ZASN_ITEM-CARTON_ID,
           ITEM LIKE ZASN_ITEM-ITEM,
           CARTON_LINE_NUM LIKE ZASN_ITEM-CARTON_LINE_NUM,
           CARTON_LINE_NUMBER LIKE ZASN_ITEM-CARTON_LINE_NUM,
          AEDAT(8),
          AEZET(6),
           ITEM_DESCRIPTION LIKE ZASN_ITEM-ITEM_DESCRIPTION,
           ORD_QTY(16),
           ORIGINAL_SHIP(16),
           SHIP_QTY(16),
           UPC_NUMBER LIKE ZASN_ITEM-UPC_NUMBER,
           DEALER_MEMO_PO(5),
           ORDER_LINE_NUM LIKE ZASN_ITEM-ORDER_LINE_NUM,
          STATUS LIKE ZASN_ITEM-STATUS,
           END OF ts_item.
    TYPES: BEGIN OF ts_carton,
          ZSHIPMENT LIKE ZASN_CARTON-ZSHIPMENT,
          VBELN LIKE ZASN_CARTON-VBELN,
          ORDER_NUMBER LIKE ZASN_CARTON-ORDER_NUMBER,
           CARTON_ID LIKE ZASN_CARTON-CARTON_ID,
          AEDAT(8),
          AEZET(6),
           SHIP_INDICATOR LIKE ZASN_CARTON-SHIP_INDICATOR,
           TRACKING_NUMBER LIKE ZASN_CARTON-TRACKING_NUMBER,
           ZZCARTON_WGT(18),
           Item type ts_item,
           END OF ts_carton.
    TYPES: BEGIN OF ts_order,
          ZSHIPMENT LIKE ZASN_ORDER-ZSHIPMENT,
          VBELN LIKE ZASN_ORDER-VBELN,
           ORDER_NUMBER LIKE ZASN_ORDER-ORDER_NUMBER,
          AEDAT(8),
          AEZET(6),
           SUB_ORDER LIKE ZASN_ORDER-SUB_ORDER,
           ORDER_DATE(8),
           PRIMARY_ORDER LIKE ZASN_ORDER-PRIMARY_ORDER,
           CUSTOMER_PO LIKE ZASN_ORDER-CUSTOMER_PO,
           PRIMARY_ID LIKE ZASN_ORDER-PRIMARY_ID,
           SHIP_TO LIKE ZASN_ORDER-SHIP_TO,
          ANZPK(5),
           carton type ts_carton,
           END OF ts_order.
    TYPES: BEGIN OF ts_delivery,
          ZSHIPMENT LIKE ZASN_DELIVERY-ZSHIPMENT,
          VBELN LIKE ZASN_DELIVERY-VBELN,
          AEDAT(8) TYPE C,
          AEZET(6) TYPE C,
           PRIMARY_CUSTOMER LIKE ZASN_DELIVERY-PRIMARY_CUSTOMER,
           BILL_OF_LADING LIKE ZASN_DELIVERY-BILL_OF_LADING,
           CARTON_COUNT(5),
           TOTAL_WEIGHT(18),
           order type ts_order,
           END OF ts_delivery.
    TYPES: BEGIN OF ts_shipment,
           ZSHIPMENT LIKE ZASN_SHIPMENT-ZSHIPMENT,
           MANIFEST_DATE_TIME(25),
          AEDAT(8) TYPE C,
          AEZET(6) TYPE C,
          SDATE(8) TYPE C,
          STIME(6) TYPE C,
           SFACILITY_NUMBER LIKE ZASN_SHIPMENT-SFACILITY_NUMBER,
           ZZCARRIERCODE LIKE ZASN_SHIPMENT-ZZCARRIERCODE,
           Delivery type ts_delivery,
           END OF ts_shipment.
    TYPES: BEGIN OF ts_shipment1,
           ZSHIPMENT LIKE ZASN_SHIPMENT-ZSHIPMENT,
           MANIFEST_DATE_TIME(25),
           SFACILITY_NUMBER LIKE ZASN_SHIPMENT-SFACILITY_NUMBER,
           ZZCARRIERCODE LIKE ZASN_SHIPMENT-ZZCARRIERCODE,
           PRIMARY_CUSTOMER LIKE ZASN_DELIVERY-PRIMARY_CUSTOMER,
           BILL_OF_LADING LIKE ZASN_DELIVERY-BILL_OF_LADING,
           CARTON_COUNT(5),
           TOTAL_WEIGHT(18),
           ORDER_NUMBER LIKE ZASN_ORDER-ORDER_NUMBER,
           SUB_ORDER LIKE ZASN_ORDER-SUB_ORDER,
           ORDER_DATE(8),
           PRIMARY_ORDER LIKE ZASN_ORDER-PRIMARY_ORDER,
           CUSTOMER_PO LIKE ZASN_ORDER-CUSTOMER_PO,
           PRIMARY_ID LIKE ZASN_ORDER-PRIMARY_ID,
           SHIP_TO LIKE ZASN_ORDER-SHIP_TO,
           CARTON_ID LIKE ZASN_CARTON-CARTON_ID,
           SHIP_INDICATOR LIKE ZASN_CARTON-SHIP_INDICATOR,
           TRACKING_NUMBER LIKE ZASN_CARTON-TRACKING_NUMBER,
           ZZCARTON_WGT(18),
           ITEM LIKE ZASN_ITEM-ITEM,
           CARTON_LINE_NUM LIKE ZASN_ITEM-CARTON_LINE_NUM,
           CARTON_LINE_NUMBER LIKE ZASN_ITEM-CARTON_LINE_NUM,
           ITEM_DESCRIPTION LIKE ZASN_ITEM-ITEM_DESCRIPTION,
           ORD_QTY(16),
           ORIGINAL_SHIP(16),
           SHIP_QTY(16),
           UPC_NUMBER LIKE ZASN_ITEM-UPC_NUMBER,
           DEALER_MEMO_PO(5),
           ORDER_LINE_NUM LIKE ZASN_ITEM-ORDER_LINE_NUM,
           END OF ts_shipment1.
    TYPES: BEGIN OF t_xml_line,
                 data(256) TYPE x,
               END OF t_xml_line.
    *Typdefinition für Airplus
    *READ THE DOCUMENTATION "LASG_XML_INVOICE_BTM"!!!
    VARs beginning with "a_" are ATTRIBUTES
    DATA: l_ixml            TYPE REF TO if_ixml,
          l_streamfactory   TYPE REF TO if_ixml_stream_factory,
          l_parser          TYPE REF TO if_ixml_parser,
          l_istream         TYPE REF TO if_ixml_istream,
          l_ostream         TYPE REF TO if_ixml_ostream,
          l_document        TYPE REF TO if_ixml_document,
          l_node            TYPE REF TO if_ixml_node,
          l_xml TYPE REF TO cl_xml_document,
          l_xmldata         TYPE string.
    DATA: l_xml_table       TYPE TABLE OF t_xml_line,
             l_xml_line        TYPE t_xml_line,
             l_xml_table_size  TYPE i.
    DATA: l_filename        TYPE string.
    DATA: xml_out TYPE string ,
          size type i.
    DATA: l_xml_x1   TYPE xstring.
    DATA: l_len      TYPE i,
              l_len2     TYPE i,
              l_tab      TYPE tsfixml,
              l_content  TYPE string,
              l_str1     TYPE string,
              c_conv     TYPE REF TO cl_abap_conv_in_ce.
             l_itab     TYPE TABLE OF string.
    DATA: BEGIN OF l_itab occurs 0,
          data(256) type c,
          end of l_itab.
    TYPES : BEGIN OF TY_TEXT,
              data(255) type C,
            END OF TY_TEXT.
    DATA: F_XML TYPE STRING.
    DATA : LT_TEXT_OUT type table of TY_TEXT with header line.
    tables
    DATA: it_shipment    TYPE STANDARD TABLE OF ts_shipment,
          wa_shipment    TYPE  ts_shipment.
    *Errorvariables
    DATA: xslt_err   TYPE REF TO cx_xslt_exception,
          err_string TYPE string.
    PARAMETERS: pa_file TYPE localfile OBLIGATORY
    DEFAULT 'C:Documents and SettingsC5134126DesktopRajesh_kandakatlaSampleASNFile.xml'.
    START-OF-SELECTION.
      Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
        PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
    here we use the CALL TRANSFORMATION method which calls
    the XSLT program "z_asnfile"
    TRY.
        CALL TRANSFORMATION ('Z_ASNFILE')
          SOURCE xml LT_TEXT_OUT[]
          RESULT xml_output = it_shipment
    catch any error, very helpful if the XSLT isn't correct
        CATCH cx_xslt_exception INTO xslt_err.
        err_string = xslt_err->get_text( ).
        WRITE: / 'Transformation error: ', err_string.
        EXIT.
      ENDTRY." setting a breakpoint to watch the workarea
    by the internal table "it_airplus"
           break-point.
      LOOP AT it_shipment INTO wa_shipment.
      ENDLOOP.
    *&      Form  get_xml_table
      FORM get_xml_table CHANGING l_xml_table_size TYPE i
                                  l_xml_table      TYPE STANDARD TABLE.
        l_filename = pa_file.
      upload a file from the client's workstation
        CALL METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename   = l_filename
            filetype   = 'BIN'
          IMPORTING
            filelength = l_xml_table_size
          CHANGING
            data_tab   = l_xml_table
          EXCEPTIONS
            OTHERS     = 19.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Convert binary to text.
    CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
      EXPORTING
        INPUT_LENGTH          = 70000
                FIRST_LINE            = 0
                LAST_LINE             = 0
                APPEND_TO_TABLE       = ' '
                MIMETYPE              = ' '
        WRAP_LINES            = 'X'
              IMPORTING
                OUTPUT_LENGTH         =
      TABLES
        BINARY_TAB            = l_xml_table
        TEXT_TAB              = LT_TEXT_OUT
              EXCEPTIONS
                FAILED                = 1
                OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    "get_xml_table

  • How to convert xml file to xsl using java

    Hi all,
    I have an XML file with which i need to convert(transform) it to an xsl file using java.
    I am new to converting xml file to xslt.Please send me if u have code .
    Thanks in advance
    regards
    Ram

    You seem to be asking the wrong question. An XSL file can be used to transform an XML file, but transforming an XML into an XSL does not make sense. The API for running XSL transforms on the Java platform is described here:
    http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html

  • 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

  • Xml to html conversion using xslt

    xml contains exponential no i.e. number in scientific notation. When it is converd to HTML, we get NaN for that number. It happens in JDK 1.4 i.e. WLS8.1 with jdk 1.4 bea jrockit jvm.
    It worked fine with wls7 using xalan-j_2_1_0/bin/xalan.jar
    ANy solution?

    Do you know of a method in the xdk that takes a well formed HTML doc and using xsd / xslt convert back to original xml spec?
    Because you created (and as long as you create) the HTML from XML it will be well formed (every tag will be ended with an end-tag) and you can therefore transform it back into XML.
    Most times it will not be possible to convert HTML found on the 'internet' into XML because this HTML is not well formed. For example, many people forget to end a paragraph of text within HTML with the </p> tag.
    We are evaluating using xslt to convert the XML to a form based medium for content maintenance. Wondering if once a XML document is parsed to HTML (DOM) can it be parsed back to XML for subsequent update to stored value in blob column. Specifically interested in conversion (parser) from HTML to XML
    Simply can HTML (in DOM format validated against a xsd) be transformed back to XML ?

  • Xml to internal table using XSLT

    hello all,
    With the help of Mr. raja I have done with  the code but still i have some problem. could any one help me(raja you too).
    XLST program code (YSIMPLEXMLTOITAB)
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:output indent="yes"/>
      <xsl:template match="QfiData">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml">
          <asx:values>
            <I_DATA>
              <xsl:for-each select="Materials">
                <I_DATA1>
                  <MATERIAL>
                    <xsl:value-of select="Material"/>
                  </MATERIAL>
                  <CONDITIONRATE>
                    <xsl:value-of select="ConditionRate"/>
                  </CONDITIONRATE>
                  <VALIDFROM>
                    <xsl:value-of select="ValidFrom"/>
                  </VALIDFROM>
                  <VALIDTO>
                    <xsl:value-of select="ValidTo"/>
                  </VALIDTO>
                  <REGIONID>
                    <xsl:value-of select="RegionID"/>
                  </REGIONID>
                  <MATERIALID>
                    <xsl:value-of select="MaterialID"/>
                  </MATERIALID>
                </I_DATA1>
              </xsl:for-each>
            </I_DATA>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:stylesheet>
    Program to test it.
    REPORT  y_test_xml_tran.
    TYPES: BEGIN OF i_det,
    Material(10),
    ConditionRate(16) type p decimals 2 ,
    ValidFrom(10) ,
    ValidTo(10) ,
    RegionID(3) ,
    MaterialID(10) ,
    end of i_det .
    DATA: i_data TYPE TABLE OF i_det.
    data: wa like line of i_data .
    DATA: xml_string TYPE string .
    DATA: xslt_error     TYPE REF TO     cx_xslt_exception,
    xslt_message     TYPE     string .
    CLEAR xml_string .
    CONCATENATE
    `<?xml version="1.0" encoding="utf-8"?>`
    `<QfiData xmlns:xsl="http://www2.siemens.nl/qfiservice/QfiData.xsd">`
    `<Materials>`
    `<Material>463581</Material>`
    `<ConditionRate> 2.44</ConditionRate>`
    `<ValidFrom>20060208</ValidFrom>`
    `<ValidTo>99991231</ValidTo>`
    `<RegionID>48</RegionID>`
    `<MaterialID>36294</MaterialID>`
    `</Materials>`
    `<Materials>`
    `<Material>463582</Material>`
    `<ConditionRate> 2.44</ConditionRate>`
    `<ValidFrom>20060208</ValidFrom>`
    `<ValidTo>99991231</ValidTo>`
    `<RegionID>48</RegionID>`
    `<MaterialID>36295</MaterialID>`
    `</Materials>`
    `</QfiData>`
    INTO xml_string .
    TRY .
        CALL TRANSFORMATION (`YSIMPLEXMLTOITAB`)
        SOURCE XML  xml_string
        RESULT     i_data = i_data.
      CATCH cx_xslt_exception INTO xslt_error.
        xslt_message = xslt_error->get_text( ).
    ENDTRY.
    the error i am getting is:
    Error message : ABAP XML formatting error in XML node of type "element", name: "abap"

    Can you tell how did you solve ?

  • Converting XML Document to String

    Dear All,
    I am quite new to Java Web Services. I have made a Java Class which calls all the web services . I am displaying the results on a Command prompt. Below is my sample code:
    import javax.xml.rpc.Service;
    import javax.xml.rpc.Stub;
    import horusWS.Horus_x0020_Web_x0020_Services_Impl;
    import horusWS.Horus_x0020_Web_x0020_ServicesSoap;
    public class JavaClient {
    public static void main(String[] args)
    Horus_x0020_Web_x0020_Services_Impl service = new Horus_x0020_Web_x0020_Services_Impl();
    Horus_x0020_Web_x0020_ServicesSoap port = service.getHorus_x0020_Web_x0020_ServicesSoap();
    String str;
    str = port.getTextFeedbackLearner(1,"P001",1);
    //where getTextFeedbackLearner is the my Web Service.
    System.out.println(str);
    System.out.println returns the web service in string format. Now I want to compare this string to my actual getTextFeedbackLearner.xml file. But I think I need to convert getTextFeedbackLearner.xml to string first. Please let me know
    how can I convert an XML Document to String.
    Thanking you in Anticipation.
    cheers,
    Sunil Sabir

    You can read the XML document as you read any other file.
    Read it into a String variable.
    Check java.io.FileReader, java.io.BufferReader, etc.

  • Sequencing a node in Target using XSLT

    Hi,
    I need to give numbering to a node on the target evertime it occurs irrespective of the any field in the source. How can this be achieved using XSLT? I know this can be acheived using ora seq, but we do not want to touch the DB.
    My target should like this
    <root>
    <Item>
    <id>1</id>
    <value>some mapping from source</value>
    </Item>
    <Item>
    <id>2</id>
    <value>some mapping from source</value>
    </Item>
    <Item>
    <id>3</id>
    <value>some mapping from source</value>
    </Item>
    </root>
    the node id should be generated whenever the parent node Item occurs.
    How can this be achieved using XSLT?
    Thanks and Regards,
    Kamal
    Edited by: Kamal Dheeraj on 11-Jan-2011 01:13

    Hi Shanmu,
    Thanks for the reply.
    position() and the count will not help in this case as the source is a cascading structure and we have filters on the source, hence i cant get numbers in sequence. Any other workaround please.
    Thanks,
    Kamal

  • Convert XML file into DTD using Java

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

  • How to convert XML doc to string and vice versa?

    Assume I have a XML doc and I want to convert it into a string (and put it into a string variable).
    How can I do this?
    How can I do the opposite: Convert a string content into a XML doc?
    Peter

    Use:
    ParseEscapedXML() and ora:getContentAsString()
    See
    http://www.codeguru.com/cpp/sample_chapter/article.php/c10789__7/
    Marc

  • XML to string using xslt or java mapping

    Hi Experts,
    I want to put xml into string and i need to change lessthan symbol to "&lt"   and greaterthan symbol to "&gt" , can anyone please help me how to do this??? can you provide code for java mapping or XSLT mapping to achive this.
    SOURCE
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:source_mt xmlns:ns0="urn:ppp:prototype">
       <row>
          <name1>IT</name1>
          <name2>SOLUTIONS</name2>
       </row>
    </ns0:source_mt>
    TARGET
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:target_mt xmlns:ns0="urn:ppp:prototype">
       <row>
          <Body>"&lt"name1"&gt" IT"&lt"/name1"&gt" "&lt"name2"&gt" SOLUTIONS"&lt";/name2"&gt" </Body>
       </row>
    </ns0:target_mt>

    Hi ,
          here is the XSLT code to obtain the desired output
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="/">
    <ns0:target_mt xmlns:ns0="urn:ppp:prototype">
         <xsl:for-each select="//row">
              <row>
                   <Body>
                        <xsl:for-each select="name1">
                                  <xsl:value-of select="concat('*&quot;&lt;&quot;name1&quot;&gt;&quot;*',normalize-space(.),'*&quot;&lt;&quot;/name1&quot;&gt;&quot;*')"></xsl:value-of>
                        </xsl:for-each>     
                        <xsl:for-each select="name2">
                                  <xsl:value-of select="concat('*&quot;&lt;&quot;name2&quot;&gt;&quot;*',normalize-space(.),'*&quot;&lt;&quot;/name2&quot;&gt;&quot;*')"></xsl:value-of>
                        </xsl:for-each>
                   </Body>
              </row>
         </xsl:for-each>
    </ns0:target_mt>      
    </xsl:template>
    </xsl:stylesheet>
    output produced as viewed in browser is
    http://postimage.org/image/1lqbgw8kk/
    Now to obtain exactly the output you posted earlier here is the code
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="/">
    <ns0:target_mt xmlns:ns0="urn:ppp:prototype">
         <xsl:for-each select="//row">
              <row>
                   <Body>
                        <xsl:for-each select="name1">
                                  <xsl:value-of select="concat('*&quot;&amp;lt&quot;name1&quot;&amp;gt&quot;*',normalize-space(.),'*&quot;&amp;lt&quot;/name1&quot;&amp;gt&quot;*')"></xsl:value-of>
                        </xsl:for-each>     
                        <xsl:for-each select="name2">
                                  <xsl:value-of select="concat('*&quot;&amp;lt&quot;name2&quot;&amp;gt&quot;*',normalize-space(.),'*&quot;&amp;lt&quot;/name2&quot;&amp;gt&quot;*')"></xsl:value-of>
                        </xsl:for-each>
                   </Body>
              </row>
         </xsl:for-each>
    </ns0:target_mt>      
    </xsl:template>
    </xsl:stylesheet>
    output you can see from link below
    http://postimage.org/image/2c7bzo478
    Hope this helps.
    Hi,
        Could you please kindly let us know if the solution is working properly as per your requirement?
    regards
    Anupam
    Edited by: anupamsap on Jul 26, 2011 6:29 AM
    Edited by: anupamsap on Jul 26, 2011 4:10 PM

  • Printint XML string using  XSLT mapping

    Hi,
    I'm trying to build a outgoing SOAP message with in XI, my backedn legacy application expect the soap message to be in certain format. It expect the xml request passed in the body of the message as whole xml string. I need to pring the xml something like this, I would appreciate if anyone had implemented something like this before. if you look at the below message I'm enclosing the whole xml string in the data element.
    <data xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <crm:schedule_call_request session_id="mid://07060623130210031519@elnk_crm.com" target_system_id="csi_ivr" xmlns:crm="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd" xmlns:xcommon="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd"> <crm:call_parameter global_rules_version_id="" manual_request="true" originating_skillset="TS (DU/BB)|ADSL RETAIL" parameter_version_id="1" transfer_skillset="TSBBDSL...WinELNK"> <crm:call_id>10031519</crm:call_id> <crm:department_name>TS</crm:department_name> <crm:object_type>CASE</crm:object_type> <crm:object_id>73079085</crm:object_id> <crm:call_time>2007-06-07T12:30:01.000-08:00</crm:call_time> <crm:customer_phone_number>6263452656</crm:customer_phone_number> <crm:override_attempts>false</crm:override_attempts> <crm:retry_count>3</crm:retry_count> <crm:call_trigger>3000</crm:call_trigger> <crm:call_time_padding>10</crm:call_time_padding> <crm:override_local_customer_call_hours>false</crm:override_local_customer_call_hours> </crm:call_parameter> </crm:schedule_call_request></data>

    Hi
    thanks for responding. here is the input SOAP message that I was building in the XLT mapping. I was stuck at putting the xml in the data element.
    soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    - <soapenv:Header>
    - <wsa:EndpointReference soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
      <wsa:Address xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">https://xmlc-qe.corp.earthlink.net/ws_xmlc/s_router</wsa:Address>
      <wsa:ServiceName wsa:PortName="XMLCollectivePort" xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">wsa:ServiceName</wsa:ServiceName>
      </wsa:EndpointReference>
      <wsa:To soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">https://xmlc-qe.corp.earthlink.net/ws_xmlc/queues/csi_queue</wsa:To>
      <wsa:Action soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">https://xmlc-qe.corp.earthlink.net/ws_xmlc/action//messaging/put_single</wsa:Action>
      <wsa:MessageID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">07060623130210031519</wsa:MessageID>
    - <wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">
    - <wsse:UsernameToken>
      <wsse:Username xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">elnk_crm</wsse:Username>
      <wsse:Password wsse:Type="wsse:PasswordDigest" xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">20UioFa77hI6MLhlc+KPDF95Hx0=</wsse:Password>
      <wsse:Nonce xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">VlX1Jpoq+vkQCQ8af2SaCDP1u9c=</wsse:Nonce>
      <wsu:Created xsi:type="soapenc:string" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">2007-06-06T23:13:12Z</wsu:Created>
      </wsse:UsernameToken>
      </wsse:Security>
      </soapenv:Header>
    - <soapenv:Body>
    - <ns1:SubmitRequest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="SubmitRequest">
      <data xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <crm:schedule_call_request session_id="mid://07060623130210031519@elnk_crm.com" target_system_id="csi_ivr" xmlns:crm="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd" xmlns:xcommon="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd"> <crm:call_parameter global_rules_version_id="" manual_request="true" originating_skillset="TS (DU/BB)|ADSL RETAIL" parameter_version_id="1" transfer_skillset="TSBBDSL...WinELNK"> <crm:call_id>10031519</crm:call_id> <crm:department_name>TS</crm:department_name> <crm:object_type>CASE</crm:object_type> <crm:object_id>73079085</crm:object_id> <crm:call_time>2007-06-07T12:30:01.000-08:00</crm:call_time> <crm:customer_phone_number>6263452656</crm:customer_phone_number> <crm:override_attempts>false</crm:override_attempts> <crm:retry_count>3</crm:retry_count> <crm:call_trigger>3000</crm:call_trigger> <crm:call_time_padding>10</crm:call_time_padding> <crm:override_local_customer_call_hours>false</crm:override_local_customer_call_hours> </crm:call_parameter> </crm:schedule_call_request></data>
      </ns1:SubmitRequest>
      </soapenv:Body>
      </soapenv:Envelope>

Maybe you are looking for

  • Problem with addRow and MultiLine Cell renderer

    Hi , Ive a problem with no solution to me ....... Ive seen in the forum and Ivent found an answer....... The problem is this: Ive a JTable with a custom model and I use a custom multiline cell renderer. (becuse in the real application "way" hasnt sta

  • Unable to retrieve nametab info for logic table BSEG during Database Export

    Hi, Our aim is to Migrate to New hardware and do the Database Export of the existing System(Unicode) and Import the same in the new Hardware I am doing Database Export on SAP 4.7 SR1,HP-UX ,Oracle 9i(Unicode System) and during Database Export "Post L

  • Fixing Some of the Spry Menu Limitations

    Example and Tutorial: http://www.projectseven.com/testing/adobe-bugs/spry-menus/ Spry menus bug me. Not because I dislike Adobe and not even because my company makes menu tools for Dreamweaver. Spry menus bug me because they are targeted at beginners

  • PI 1.2 Heat Maps are offset

    Hi, after upgrading to PI 1.2 the heat maps are offset. Worked fine before and also I've noticed that some of my maps do look fine until I reposition an AP on it, then all AP heat maps on that map will then be offset. Has anyone else see this issue?

  • Header of a Descriptive Flexfield

    Hi all, I've created a descriptive flex in my page but the text I set in Prompt property doesn't appear in runtime. The user wants to have a header saying "Additional Shipment Information" before their custom attributes. Do I have to create a header