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 ?

Similar Messages

  • 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

  • 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 feed data to generate a html file using XSLT?

    I need to implement email content generation in the hmtl format using XSLT. The document information is stored in a xsl file and the data is generated dynmically in the application. How to feed the data to have the file?
    Thanks,
    v.

    Thanks for your information. I, however, already thought about using string stream instand of a XML file to pass in data. I am looking for a more intelligent method. It doesn't seem to have one so far.

  • 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

  • Pdf to xml or html conversion

    i want to convert .pdf to xml or html so that i can make entries in the database.
    any help>???

    there are a number of java libraries that can read PDF files. Once you can read them, you can convert them to xml/html/etc.
    A good list of products can be found at
    http://www.geocities.com/marcoschmidt.geo/java-libraries-pdf.html

  • XML to CSV routine using XSLT.  Oracle bugs?

    I'm trying to write some XSLT so that I can apply it to any given XML using  XMLTransform to generate a flattened CSV structure.  My input can be any XML document, with any number of nested levels so the structure isn't known to the XSLT.  I'm fairly new to XSLT but am having problem with Oracle's version of it.  I've tested on both 10gR2 and 11gR2.
    CSV Rules :
    Adjacent fields must be separated by a comma
    Embedded commas in fields are escaped e.g. 15, Maple Street => "15, Maple Street"
    Embedded quotes in fields are escaped.  e.g. O'Brien => "O'Brien" or John "Jonner" McNabb => "John ""Jonner"" McNabb"
    Embedded CR / LF or CRLF in fields are escaped with quotes.
    Records are separated with CRLF pairs
    Flattening Rules :
    The text of leaf elements (elements without children) are output even if they are empty
    Any element with text is output
    A new line occurs whenever the nesting level changes. i.e. If an element has children.
    When I run the following XML and my XSLT through Oracle I get results inconsistent with results I get when I run the XML and XSLT through online XSLT utils (including W3C's test pages).
    with qryXML as (
      select xmltype(q'[
      <email>
        <to>Steve O'Brien</to>
        <cc/>
        <from>Jane "The Smiler" Griff</from>
        <heading>Reminder</heading>
        <body>Hey, don't forget me this weekend!  I've enclosed some pics from last weekend
      Love Jane
      </body>
        <attachments>
          <attachment>
            <filename>Dance.jpg</filename>
            <encoding>MIME</encoding>
          </attachment>
          <attachment>
            <filename>Signature.txt</filename>
            <encoding/>
          </attachment>
        </attachments>
      </email>
      ]') as XMLDATA from dual)
    select
       XMLTransform(q.XMLDATA,
          xmltype(q'[
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="text"/>
        <xsl:strip-space elements="*"/>
        <xsl:template match="*[text() or not(*)]">
            <xsl:if test="position() &gt; 1">
                <xsl:text>,</xsl:text>
            </xsl:if>
        <xsl:call-template name="display_csv_field">
          <xsl:with-param name="field" select="."/>
        </xsl:call-template>
            <xsl:if test="not(following-sibling::*[text() or not(*)])">
                <xsl:text>
    </xsl:text>         
            </xsl:if>
        </xsl:template>
      <xsl:template name="display_csv_field">
        <xsl:param name="field"/>
        <xsl:variable name="CRLF">
          <xsl:text>&#13;&#10;</xsl:text>
        </xsl:variable>
        <xsl:variable name="CR">
          <xsl:text>&#13;</xsl:text>
        </xsl:variable>
        <xsl:variable name="LF">
          <xsl:text>&#10;</xsl:text>
        </xsl:variable>
        <xsl:variable name="apos">'</xsl:variable>   
        <xsl:choose>
          <xsl:when test="contains( $field, '&quot;' )">
            <!-- Field contains a quote. So escape  -->
            <xsl:text>"</xsl:text>
            <xsl:call-template name="escape_quotes">
              <xsl:with-param name="string" select="$field" />
            </xsl:call-template>
            <xsl:text>"</xsl:text>
          </xsl:when>
          <xsl:when test="contains( $field, ',' ) or
                          contains( $field, $apos ) or
                          contains( $field, $CRLF ) or
                          contains( $field, $CR ) or
                          contains( $field, $LF )" >
            <!-- Field contains a comma, apostrophe and/or a linefeed, so quote -->
            <xsl:text>"</xsl:text>
            <xsl:value-of select="$field" />
            <xsl:text>"</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <!-- No need to enclose this field in quotes. -->
            <xsl:value-of select="$field" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template>
      <xsl:template name="escape_quotes">
        <xsl:param name="string" />
        <xsl:value-of select="substring-before( $string, '&quot;' )" />
        <xsl:text>""</xsl:text>
        <xsl:variable name="substring_after_first_quote"
                      select="substring-after( $string, '&quot;' )" />
        <xsl:choose>
          <xsl:when test="not( contains( $substring_after_first_quote, '&quot;' ) )">
            <xsl:value-of select="$substring_after_first_quote" />
          </xsl:when>
          <xsl:otherwise>
            <!-- The substring after the first quote contains a quote.
                 So, we call ourself recursively to escape the quotes
                 in the substring after the first quote. -->
            <xsl:call-template name="escape_quotes">
              <xsl:with-param name="string" select="$substring_after_first_quote" />
            </xsl:call-template>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template> 
    </xsl:stylesheet>
    )) from qryXML q  
    Output from Oracle (which appears incorrect)
    &quot;Steve O&apos;Brien&quot;&quot;Jane &quot;&quot;The Smiler&quot;&quot; Griff&quot;Reminder&quot;Hey, don&apos;t forget me this weekend!  I&apos;ve enclosed some pics from last weekend
      Love Jane
      &quot;
    Dance.jpgMIME
    Signature.txt
    Output from most other XSLT test environments (which appears correct):
    "Steve O'Brien",,"Jane ""The Smiler"" Griff",Reminder,"Hey, don't forget me this weekend!  I've enclosed some pics from last weekend
    Love Jane
    Dance.jpg,MIME
    Signature.txt,
    Oracle's XSLT handling appears incorrect in several ways:
    1. There is no comma delimiter separating fields and on investigation, position() is always returning 1, which is incorrect.  From XSLT reference "The position function returns a number equal to the context position from the expression evaluation context." ...."the position, or index number, of the node, relative to all the selected nodes in the node list."  Therefore any node in a node list should be indexable with position.   I am selecting a node list *[text() or not(*)] => Any nodes with text or with no children, yet position of each node in this list is always 1.
    2. My XSLT says the output is text, yet Oracle is still using HTML character escaping which is not text!  &quot; instead of " and &apos; instead of '.  I could search and replace, but I shouldn't have to.
    Can anyone explain why Oracle's XSLT differs from other XSLT processors and offer suggestions to solve these issues.  Are these bugs?

    Here's an example tested on 11.2.0.2 :
    SQL> set scan off
    SQL> set long 5000
    SQL> set lines 200
    SQL> var doc clob
    SQL> begin
      2   :doc := '<email>
      3      <to>Steve O''Brien</to>
      4      <cc/>
      5      <from>Jane "The Smiler" Griff</from>
      6      <heading>Reminder</heading>
      7      <body>Hey, don''t forget me this weekend!  I''ve enclosed some pics from last weekend
      8    Love Jane
      9    </body>
    10      <attachments>
    11        <attachment>
    12          <filename>Dance.jpg</filename>
    13          <encoding>MIME</encoding>
    14        </attachment>
    15        <attachment>
    16          <filename>Signature.txt</filename>
    17          <encoding/>
    18        </attachment>
    19      </attachments>
    20    </email>';
    21  end;
    22  /
    PL/SQL procedure successfully completed.
    SQL> select xmlcast(
      2           xmlquery(
      3           'declare function local:formatField ($e as element()) as xs:string
      4            {
      5              let $t := ora:replace($e, "&quot;", "&quot;&quot;")
      6              return if (    contains($t, "&quot;")
      7                          or contains($t, ",")
      8                          or contains($t, "&apos;")
      9                          or contains($t, "&#13;")
    10                          or contains($t, "&#10;") )
    11                     then concat("&quot;", $t, "&quot;")
    12                     else $e
    13            }; (::)
    14            string-join(
    15              for $i in //*[*[text() or not(node())]]
    16              return
    17                string-join(
    18                  for $j in $i/*[text() or not(node())]
    19                  return local:formatField($j)
    20                , ","
    21                )
    22            , "&#13;&#10;"
    23            )'
    24             passing xmltype(:doc)
    25             returning content
    26           )
    27           as clob
    28         ) as result
    29  from dual ;
    RESULT
    "Steve O'Brien",,"Jane ""The Smiler"" Griff",Reminder,"Hey, don't forget me this
    weekend!  I've enclosed some pics from last weekend
      Love Jane
    Dance.jpg,MIME
    Signature.txt,
    We could also use a single ora:matches function in place of the OR'ed contains but it doesn't appear to work on 11.2.0.3, got an internal error :
    ORA-00600: code d'erreur interne, arguments : [qmxqrs_xvm_popLastFuncArgAsStr:1], [], [], [], [], [], [], [], [], [], [], []

  • 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

  • XML to SQL conversion using OracleXML putXML

    Hi,
    How many rowTag values can I use when I use OracleXML putXML ? I have an XML file in the following format.
    I have to use "ABC" as rowTag. What Can I do with "GRANT_ROW" ? I have a table with
    R_DATE and
    GRANT columns
    where GRANT is an object type with elements
    NAME and ATYPE.
    Thanks.
    <?xml version = '1.0'?>
    <EXCH>
    <ABC num="1">
    <R_DATE>5/21/2003 0:0:0</R_DATE>
    <GRANT>
    <GRANT_ROW num="1">
    <NAME>GUNACAR</NAME>
    <ATYPE>TE</ATYPE>
    </GRANT_ROW>
    <GRANT_ROW num="2">
    <NAME>GUNACAR</NAME>
    <TYPE>TE</TYPE>
    </GRANT_ROW>
    </GRANT>
    </ABC>
    </EXCH>
    I get the following error when I run
    java OracleXML putXML ....
    oracle.xml.sql.OracleXMLSQLException: 'The XML element tag 'GRANT_ROW'
    does not match the name of any of the columns/attributes of the
    target database object.' encountered during processing ROW element 0.
    Thanks....

    RTF FormattingKit
    http://www.schema.de/sitehtml/site-e/xmlnach0.htm

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

  • Reg XML to Plain Conversion using B2B add on

    Hi All,
    This is an outbound scenario where the  message is sent to AS2 receiver channel and the output is Plain file. I have added all the module parameters
    and the content type as application/plain. While testing I am facing the error,
    Exception caught by adapter framework: XML-Parser error occured while parsing: Cannot initialize XML to plain handlerCan not find a matching configuration for sender party "", service , receiver party ,service , namespace , action  in table B2B_PLA_CTRL_IF.
    Can anyone help me on this issue.
    Cheers,
    Neethu

    Hi Neethu,
    Did you import the content? See How to install the new B2B add-on , see step 5.1
    You need to do this for the message type you want to exchange ((EDI, ansi X.12, ...).
    Also, please do step 5.2. I guess this is not the case.
    Kind regards,
    Dimitri

  • String to XML using XSLT..

    Hey folks
    Am having a XML in a single string in ma request and wanna convert that into a XML. Tried that using XSLT but seems am missing out on some point...It works fine with Stylus but fails within PI 
    Following code am using :
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.sdn.com/xslt">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
       <xsl:template match="/">
            <xsl:for-each select="//*:string">
             <xsl:value-of select="." disable-output-escaping="yes"/>
          </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    The name of the element in which i get the whole XML is  "string".
    My request string is something liek this :
    <xml version="1.0" encoding="UTF-8"?><ProductDefinition><RefNo>23232323</RefNo><Description>dfdfdfdfdf</Description></ProductDefinition>
    Now am trying to generate a XML using the XSL but its failing in PI...
    Kindly point out where am i going wrong?

    Thanks, but graphical mapping does not expose <![CDATAhttp:// ... ] to be removed. Surely this must be done with XSLT?+
    Don't worry about <![CDATA ... pass your whole string in source message like this : <![CDATAhttp://<?xml version=\"1.0\" encoding=\"UTF-8\"?><ProductDefinition><RefNo>12345</RefNo><Description>Test</Description></ProductDefinition>]>
    1st the graphical mapping where you use replace string will replace <?xml version=\"1.0\" encoding=\"UTF-8\"?>  and then the XSLT mapping would get a input like this : <![CDATAhttp://<ProductDefinition><RefNo>12345</RefNo><Description>Test</Description></ProductDefinition>]> which would eventually form your target structure...
    I tried it myself few days back so its a sure shot method ... just try it 
    Cheers!!!
    Soumen 

  • XML 2 HTML. Please help..

    Is there any standard API / programme(already written) in Java, to convert a HTML document to XML and also XML to HTML.
    Any suggestions, tips, links are appreciated. Please help.
    Thanks in advance,
    Xej.

    Hi!
    For XML to HTML conversion I use XSL transformation utilizing Xalan for Java(xml.apache.org). The other way round is not such an easy task because HTML is a little bit unpredictable with its tag usage. For example a <br> tag as line break is ok for all browsers but it's not well formed XML - in this case it should be
    If HTML is well formed in XML terms it's called XHTML and since that is a XML language you could use XSL for transforming it into another XML document.
    ~k

  • Handling Multi hierarchial Structure using  XSLT or Java Mapping in XI

    Hello Experts,
    I have an requirement wherein i have sender as IDOC and File as Receiver.My target File structure is multi hierarchial with parent level and many child sub level node.
    I tried to generate flat structure using graphical mapping by creating an intermediate structure and then mapping it to flat structure but that seems to be very complex for my scenario as there are many sub level at target structure..
    Is there any simple way of handlng these????
    Thanks

    Hi ,
    I tried to implement your solution ..I am able to convert my idoc to XMLusing XLST but i have a question that how to convert that XMP to flat file as XI Receiver File adapter understand only 1st level of hierarchy..It doesnt understand nested level of hierarchy which is in my case...
    Below is the xslt code which i have written:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="/">
              <MT_SALES_PO_DATA_INBOUND>
                   <xsl:value-of select="WPUBON01/IDOC"/>
                   <xsl:for-each select="WPUBON01/IDOC/E1WPB01">
                        <E1WBBB01>
                             <Store_ID>A001</Store_ID>
                             <SYS_INVOICE_NO>
                                  <xsl:value-of select="substring(BONNUMMER,'3','15')"/>
                             </SYS_INVOICE_NO>
                             <Cashier_ID>
                                  <xsl:value-of select="KASSID"/>
                             </Cashier_ID>
                        </E1WBBB01>
                   </xsl:for-each>
                   <xsl:for-each select="WPUBON01/IDOC/E1WPB01/E1WPB02">
                        <E1WBB02>
                             <Transaction_Type>
                                  <xsl:value-of select="VORGANGART"/>
                             </Transaction_Type>
                             <Article_Description>
                                  <xsl:value-of select="QUALARTNR"/>
                             </Article_Description>
                             <ITEM_CODE>
                                  <xsl:value-of select="ARTNR"/>
                             </ITEM_CODE>
                             <xsl:for-each select="WPUBON01/IDOC/E1WPB01/E1WPB02/E1WBB03">
                                  <E1WBB03>
                                       <Condition_Type>
                                            <xsl:value-of select="KONDITION"/>
                                       </Condition_Type>
                                       <xsl:for-each select="">
                                            <E1WBB04>
                                                 <TAX_Code>
                                                      <xsl:value-of select="MWSKZ"/>
                                                 </TAX_Code>
                                                 <TAX_Amount>
                                                      <xsl:value-of select="MWSBT"/>
                                                 </TAX_Amount>
                                            </E1WBB04>
                                       </xsl:for-each>
                                  </E1WBB03>
                             </xsl:for-each>
                        </E1WBB02>
                   </xsl:for-each>
              </MT_SALES_PO_DATA_INBOUND>
         </xsl:template>
    </xsl:stylesheet>
    Any idea how do i convert these XML to falt file USing XSLT or File Receiver adapter in XI???
    Thanks

  • Idoc to flat file mapping using XSLT

    Hi,
    i am using XSLT mapping. my requirement is mapping between idoc and flat file(xml to text). as i do not want to use FCC, i have opted for xslt mapping. please let me know any article which would be helpful for this.
    regards,
    Meenakshi

    Hi Meenakshi,
    Two things:
    1. Achieving this functionality  using XSLT is very difficult.
    2. Secondly you may not be able to find a direct document to convert IDoc-XML to flat file using XSLT in sdn. Try google.
    I found one link like that may be you can get some idea from there
    http://www.stylusstudio.com/SSDN/default.asp?action=9&read=6453&fid=48
    Also if you have a XSLT editor like XMLSPY or stylus studio then creating your specific XSLT will b much more simpler
    Regards
    Suraj

Maybe you are looking for