Problem writing a XSLT to convert XML in desired format from a table having self join

Hello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
D

Hello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
D

Similar Messages

  • Convert XML to JSON format

    Hi all,
    I need to do a POC on converting XML format to JSON format,i found that there is rest adapter which we can achieve this  ,
    but i couldn't find the adapter in the list of adapters ,how to download this adapter from sap market place and also is there any alternative way of achieving this.

    Hi Vidya Sagar,
    REST Adapter is not available for free like SOAP, FTP, SFTP etc Adapters. You need to purchase it from third party vendors like Advantco. You can visit the link below for more information:
    REST Adapter for SAP NW PI | Advantco SAP NetWeaver Solutions
    https://www.advantco.com/misc/Gateway%20or%20Progress%20Integration.pdf
    Alternate way to convert XML to JSON and viceversa is use of open source technology - Apache Camel. You can download the Apache Camel from the link below:
    Apache Camel: Camel 2.13.2 Release
    Also you can refer to tutorials and examples available on the site - Apache Camel: Tutorials for the implementation.
    Regards,
    Shreyansh Shah

  • Creating XML file using data from database table

    I have to create an xml file using the data from multiple table. The problem That i am facing is the data is huge it is in millions so I was wondering that is there any efective way of creating such an xml file.
    It would be great if you can suggest some approach to achieve my requirement.
    Thanks,
    -Vinod

    An example from the forum: Re: How to generate xml file from database table
    Edited by: Marco Gralike on Oct 18, 2012 9:41 PM

  • Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field

    Hello,
    I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
    Table structures are mentioned below:
    OP:
    Name                             Null                    Type        
    OP_NBR                    NOT NULL      NUMBER(4)    (Primary Key)
    OP_DESC                                        VARCHAR2(50)
    OP_PAYLOD_XML                           CLOB       
    GM:
    Name                          Null                   Type        
    GM_NBR                  NOT NULL       NUMBER(4)    (Primary Key)
    GM_DESC                                       VARCHAR2(40)
    OP_NBR               NOT NULL          NUMBER(4)    (Foreign Key)
    GM_PAYLOD_XML                          CLOB   
    DM:
    Name                          Null                    Type        
    DM_NBR                  NOT NULL         NUMBER(4)    (Primary Key)
    DM_DESC                                         VARCHAR2(40)
    GM_NBR                  NOT NULL         NUMBER(4)    (Foreign Key)
    DM_PAYLOD_XML                            CLOB       
    DE:
    Name                          Null                    Type        
    DE_NBR                     NOT NULL           NUMBER(4)    (Primary Key)
    DE_DESC                   NOT NULL           VARCHAR2(40)
    DM_NBR                    NOT NULL           NUMBER(4)    (Foreign Key)
    DE_PAYLOD_XML                                CLOB    
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT
    j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
    i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
    h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
    g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
    FROM
    DE g, DM h, GM i, OP j
    WHERE
    h.dm_nbr = g.dm_nbr(+) and
    i.gm_nbr = h.gm_nbr(+) and
    j.op_nbr = i.op_nbr(+)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
    Current O/P:
    <resultSet>
         <Record1>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <DM_PAYLOD_XML1>
              <DE_PAYLOD_XML1>
         </Record1>
         <Record2>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML2>
              <DM_PAYLOD_XML2>
              <DE_PAYLOD_XML2>
         </Record2>
         <RecordN>
              <OP_PAYLOD_XMLN>
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XMLN>
         </RecordN>
    </resultSet>
    Now i want to change my SQL query so that i get following output structure:
    <resultSet>
         <Record>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <GM_PAYLOD_XML2> .......
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XML1>
              <DM_PAYLOD_XML2> .......
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XML1>
              <DE_PAYLOD_XML2> .......
              <DE_PAYLOD_XMLN>
         </Record>
         <Record>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML1'>
              <GM_PAYLOD_XML2'> .......
              <GM_PAYLOD_XMLN'>
              <DM_PAYLOD_XML1'>
              <DM_PAYLOD_XML2'> .......
              <DM_PAYLOD_XMLN'>
              <DE_PAYLOD_XML1'>
              <DE_PAYLOD_XML2'> .......
              <DE_PAYLOD_XMLN'>
         </Record>
    <resultSet>
    Appreciate your help in this regard!

    Hi,
    A few questions :
    How's your first query supposed to give you an XML output like you show ?
    Is there something you're not telling us?
    What's the content of, for example, <OP_PAYLOD_XML1> ?
    I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
    What's the db version BTW?

  • XSLT to convert XML into Tables

    Hi,
    I'm trying to import my XML data into a table format. After adding an XSL file to my Structure Application as a Preprocessing Stylesheet, and importing my XML instance file with the Template file opened, the "Unknown File Type" error window appeared asking for a file format to Convert From. Picking any one doesn't create a table.
    The XSL file tranforms the XML data into an HTML file that has a table with columns corresponding to the XML data. I was thinking using that type of XSL because it renders tables.
    Below is the XSL markup:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <html>
      <body>
      <h2>Products</h2>
        <table border="1">
          <tr bgcolor="#9acd32">
            <th>Title</th>
            <th>Number</th>
            <th>Date</th>
          </tr>
          <xsl:for-each select="Products/Product">
          <tr>
            <td><xsl:value-of select="Title"/></td>
            <td><xsl:value-of select="Number"/></td>
            <td><xsl:value-of select="Date"/></td>
          </tr>
          </xsl:for-each>
        </table>
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>
    Title, Number, and Date are child elements of the Product element, which is a child element of the Products root element in my XML file.
    Am I applying the stylesheet correctly here? Am I using the write kind of stylesheet?
    Thanks,
    zeb

    Hi Michael, Van,
    Thank you for responding to my post. Your feedback was very helpful!
    I was able to get the table to generate in FrameMaker but no data from the XML file is flowing into it. All that appears is the header row with "Title," "Number," and "Date" in the cells, and a row with blank cells underneath it. The Structure View pane has a red "<no value>" for the "Cols" and "Widths" attributes of the Table element. Only the Title column is affected by the width value.
    The XSL, RW, and EDD files are as a follows: (The structure for the XML is a "Products" root element with mulitple "Product" child elements that each have a "Title," "Name," "Date" child element.)
    ==========================XSL==================
    <xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" doctype-system="products_DTD3.dtd" />
    <xsl:template match="/">
    <products>
    <Table cols="3" width="150">
    <TableHeading>
        <TableRow>
            <TableCell>Title</TableCell>
            <TableCell>Number</TableCell>
            <TableCell>Date</TableCell>
        </TableRow>
    </TableHeading>
    <TableBody>
    <TableRow>
    <TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Title"/></xsl:for-each></TableCell>
    <TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Number"/></xsl:for-each></TableCell>
    <TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Date"/></xsl:for-each></TableCell>
    </TableRow>
    </TableBody>
    </Table>
    </products>
    </xsl:template>
    </xsl:stylesheet>
    ==========================EDD==================
    Element (Container): products
    General rule:    Table
    Valid as the highest-level element.
    Element (Table): Table
    General rule:    TableHeading,TableBody
    Attribute list
    Name: cols     String     Required
    Name: width     String     Required
    Element (Table Heading): TableHeading
    General rule:    TableRow
    Element (Table Row): TableRow
    General rule:    TableCell+
    Element (Table Cell): TableCell
    General rule:    <TEXT>
    Element (Table Body): TableBody
    General rule:    TableRow
    ==========================RW===================
    fm version is "10.0";
    element "Table" {
      is fm table element;
      attribute "cols" is fm property columns;
      attribute "width" is fm property column widths;
    element "TableRow" is fm table row element;
    element "TableHeading" is fm table heading element;
    element "TableBody" is fm table body element;
    element "TableCell" is fm table cell element;
    ===============================================
    I'm having trouble placing the "<xsl:for-each select="Products/Product">" tag in the XSL file. When I put it under  TRow, FrameMaker  gives an error that "TRow is not a valid for content (TCell)+". Only when I place it within the TCell tags (as I have above) does the above-mentioned Table with a Header row and a row with empty cells generate.
    Is the XSL the problem here?
    Thanks,
    Zeb

  • Problem with Euro sign when converting it into PDF Format

    Hi all,
    i am facing problem with Euro (u20AC) sign,
    it is displayina s #
    when converting one smartform into PDF format.
    Can any body sugest me in doing this??
    it is appriciable if any body can help m??
    thanks in advance
    Regards,
    Srikanth.

    Hi Srikanth,
    I think I'm facing the same issue as you. I looked at the note 323736 but my system seems to be up to date (at least for this issue). I have SAP_BASIS release 700.
    Did you upgrade your system ? Did you do something else ?
    Thanks for your help.
    Best regards,
    Pierre

  • How to convert xml to non xml in business service

    I have created a business service which routes the data to the respective given email addresses.But the body of the body is in the form of xml tags but need the body to be in normal document type format.
    I have tried converting xml to mlf format(with delimiter '\n') before routing but still its the same xml tag which i get it from the body ,the only change being this time its a very simple xml file with just elements in it and no namespace declaration ,namespace definition etc.Please help me solve this problem?

    I am not sure exactly in which format you want to translate the XML but you may use either MFL transformation/Java callout in OSB to convert XML into non-XML or vice-versa -
    http://download.oracle.com/docs/cd/E14571_01/doc.1111/e15866/part_fb.htm#BABEAIAF
    Regards,
    Anuj

  • XSLT for converting the determination server xml into the debugger xml

    I've seen this before but i can't find the post. I'm looking for an xsl or xslt document to convert a determination server xml payload request into something that can be imported into the debugger for analysis. It would be cool if the xml was constrained by the same xsd or dtd. Does anyone have a 10.3 xsl or xslt they could share? Or a past xsl?

    A while back I wrote some XSLT to convert SOAP request messages to the XDS format. I created a simple C# GUI to select the input SOAP and output XDS files. It was modelled on 10.1 schema though and I haven't adapted it yet for 10.2+. I will at some point though.
    I've found quickly being able to convert to the XDS format and debugging in the OPM rather than trawling through 1000's of lines of decision report a huge time saver.
    Evert

  • Problem in converting XML to XML file

    Hi,
    I am trying to convert xml file to another xml through command-line interface but failed.
    java oracle.xml.parser.v2.oraxsl data.xml data.xsl data_new.xml
    My xml and xsl files are:
    1. XML file
    <employee_data>
    <employee_row>
    <employee_number>7950</employee_number>
    <employee_name>ABC</employee_name>
    <employee_title>PRESIDENT</employee_title>
    <manager>1111</manager>
    <date_of_hire>20-JAN-93</date_of_hire>
    <salary>65000</salary>
    <commission>1000</commission>
    <department_number>10</department_number>
    </employee_row>
    </employee_data>
    2-1 XSL file
    <?xml version="1.0" ?>
    <xsl:stylesheet xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="*">
    <xsl:copy>
    <xsl:apply-templates>
    <xsl:sort select=".//employee_name"/>
    </xsl:apply-templates>
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>
    2-2 XSL file
    <?xml version = "1.0"?>
    <ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:for-each select="employee_data/employee_row">
    <ROW>
    <EMPNO><xsl:value-of select="employee_number"/></EMPNO>
    <ENAME><xsl:value-of select="employee_name"/></ENAME>
    <JOB><xsl:value-of select="employee_title"/></JOB>
    <MGR><xsl:value-of select="manager"/></MGR>
    <HIREDATE><xsl:value-of select="date_of_hire"/></HIREDATE>
    <SAL><xsl:value-of select="salary"/></SAL>
    <COMM><xsl:value-of select="commission"/></COMM>
    <DEPTNO><xsl:value-of select="department_number"/></DEPTNO>
    </ROW>
    </xsl:for-each>
    </ROWSET>
    I used two xsl file to test but received same error message:
    Error occurred while processing data.xsl: Error in expression: '*|/'.
    Does anyone know how to fix the problem? I'll appreciate it very much for your help.
    Thanks.
    Yi

    Hi,
    I have only tried it out with XML Spy, but anyway:
    there seems to be an error in your 2-1 XSl file in line 2:
    the correct stylesheet declaration is:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    You had an empty namespace and a wrong version attribute...
    HTH,
    Bernhard

  • Convert XML to XSLT element to rowset

    Hello,
    I have a web service which returns XML. I need to create an omniportlet using web service.
    The xml format is not in <rowset> format, so I need to convert to rowset format.
    I believe omniportlet understands only in rowset format.
    So how do I convert the format from <element> to <rowset> format?
    Thanks in advance.

    Damian,
    Develop an XSLT to convert the XML to text.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="text"/>
    <xsl:template match="/transfers">
    <xsl:apply-templates select="case"/>
    <xsl:apply-templates select="events/event"/>
    <xsl:apply-templates select="roles/role"/>
    </xsl:template>
    <xsl:template match="case">
    INSERT INTO CASE (CASE_ID, CLOSED_FLAG) VALUES (<xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="casenumber"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="closed"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>);
    </xsl:template>
    <xsl:template match="event">
    INSERT INTO EVENT (EVENT_NUM, CASE_ID, DETAILS, USER) VALUES (<xsl:value-of select="eventid"/>,
    <xsl:text disable-output-escaping="yes">"</xsl:text><xsl:value-of
    select="casenumber"/><xsl:text disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="narrative"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="operator"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>);
    </xsl:template>
    <xsl:template match="role">
    INSERT INTO ROLES (ROLE_NUM, PARTY_ID, CASE_ID) VALUES (<xsl:value-of select="roleid"/>,
    <xsl:text disable-output-escaping="yes">"</xsl:text><xsl:value-of
    select="partyid"/><xsl:text disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="casenumber"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>);
    </xsl:template>
    </xsl:stylesheet>thanks,
    Deepak

  • Problem using xsl to convert xml to xml

    I have and xml doc that has a format similar to this:
    <HEADER>
    <ORDER_NUMBER>
    <ORDER_DATE>
    <LINE>
    <LINE_NUMBER>
    <ITEM>
    </LINE>
    <LINE_NUMBER>
    <ITEM>
    </LINE>
    </HEADER>
    When I convert from xml to xml using xsl I do not get the second occurence of <LINE>, everything else looks fine.
    Please help.
    Thanks, John

    Hi John,
    I also have problems to convert xml to xml by xsl at command-line interface as follows.
    CLASSPATH=$ORACLE_HOME/rdbms/jlib/xsu12.jar:$ORACLE_HOME/lib/xmlparserv2.jar:$ORACLE_HOME/jdbc/lib/classes12.zip
    java oracle.xml.parser.v2.oraxsl source.xml -s myxsl.xsl destination.xml
    and I received error message as "Error occurred while processing myxsl.xsl: Error in expression: '*|/'."
    Actually, the source xml file and xsl script I used were copied from the book "Professional XML".
    Do you know what's the problem and could you show me setting for the classpath?
    Thanks.
    Yi

  • How to ignore prefix from XML while converting XML to csv using XSLT

    Hi All,
    I am trying to convert XML to csv file.
    the XML i have is like....
    <?xml version="1.0"?>
    <bulkCmConfigDataFile xmlns:es="SpecificAttributes.3.0.xsd" xmlns:un="utranNrm.xsd" xmlns:xn="genericNrm.xsd" xmlns:gn="geranNrm.xsd" xmlns="configData.xsd">
    <configData dnPrefix="Undefined">
            <xn:SubNetwork id="AU_R">
                <xn:SubNetwork id="H5RG_0501">
                    <xn:MeContext id="Firle_5070020">
                        <xn:ManagedElement id="1">
                   <un:RncFunction id="1">
                   <un:UtranCell id="50390303">
                                    <un:attributes>
                                        <un:userLabel>UtranCell 50390303</un:userLabel>
                                        <un:cId>52383</un:cId>
                                        <un:localCellId>50390303</un:localCellId>
                                        <un:uarfcnUl>9613</un:uarfcnUl>
                                        <un:uarfcnDl>10563</un:uarfcnDl>
                                        <un:primaryScramblingCode>502</un:primaryScramblingCode>
                                        <un:primaryCpichPower>287</un:primaryCpichPower>
                                        <un:maximumTransmissionPower>403</un:maximumTransmissionPower>
                                        <un:primarySchPower>-18</un:primarySchPower>
                                        <un:secondarySchPower>-20</un:secondarySchPower>
                                        <un:bchPower>-20</un:bchPower>
                                        <un:lac>50301</un:lac>
                                        <un:rac>1</un:rac>
                                        <un:sac>52383</un:sac>
                                        <un:utranCellIubLink>SubNetwork=AU_R,SubNetwork=H5RG_0501,MeContext=H5RG_0501,ManagedElement=1,RncFunction=1,IubLink=5039030</un:utranCellIubLink>
                                    </un:attributes>
                                </un:UtranCell>     
                   </un:RncFunction>
                        </xn:ManagedElement>   
                    </xn:MeContext>
             </xn:SubNetwork>
            </xn:SubNetwork>
        </configData>
    </bulkCmConfigDataFile>now when i am using XSLT functionality to convert this XML into a csv i want ignore all the prefix from this xml like "un" , "xn" etc....
    can anybody has idea how i can ignore all this value using XSLT

    I just dont understand why factory.setIgnoringElementContentWhitespace(true) did not work.That only does something if the XML has a DTD that enables it to know what whitespace can be ignored and what is significant. The API documentation for the method refers you to this document:
    http://www.w3.org/TR/REC-xml#sec-white-space

  • Writing from internal table to xml format

    Hi,
    I searched all the forum and I have a question on writing the data from internal table in xml format to the file on app.server.
    Data: ITAB1   TYPE TABLE OF SPFLI,
             L_XML  TYPE REF TO CL_XML_DOCUMENT.
      SELECT * FROM SPFLI INTO TABLE ITAB1.
    CREATE THE XML OBJECT
      CREATE OBJECT L_XML.
    CONVERT THE DATA TO XML
      CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB1[] ).
    after this how to move the XML data in the object to a file on app.server.
    Thanks

    p_ufile is the path of the application server
    p_output is the internal table with data to be moved to app serv.
    OPEN DATASET p_ufile FOR OUTPUT IN TEXT MODE.
    LOOP AT p_output INTO wa_file.
    TRANSFER wa_file TO p_ufile.
    CLEAR wa_file.
    ENDLOOP.
    CLOSE DATASET p_ufile.
    for XML I guees the path p_ufile ill be <b>sap/usr/tmp/file.xml</b>

  • Problem in Using XSLT

    I am facing a problem while using XSLT. The Problem is that  I have a Structue and corresponding internal table  defined as follows.
         TYPES:BEGIN OF X1,
            TW(4)        TYPE  c,
            TX           TYPE  int1,
            TY(1)        TYPE  c,
            TZ(32)       TYPE  X,
            TV(32)       TYPE  C,
            A TYPE CHAR32,
            B TYPE CHAR32,
            C TYPE CHAR32,
            D TYPE CHAR10,
            E TYPE INT4,
          END OF X1.
          DATA:INT_TABLE     TYPE TABLE OF X1.
    Now When I am Transforming this into XML using XSLT the attributes are being sorted on the field names as follows.
    &#65279;
    Is there any way for getting the attributes in the same order as we specify in the Types declaration. Please kindly help in solving this.

    Hi,
    You will most probably get an answer in the XI forum.
    https://www.sdn.sap.com/sdn/collaboration.sdn?node=linkFnode1-6&contenttype=url&content=https://Process Integration (PI) & SOA Middleware
    regards
    Aveek

  • XSLT Transform in XML Signature: Exception

    Hello,
    I have following problem with an XSLT tranform in my XML signature. Here is the code I use to add XSLT to signature:
    main() {
    DOMStructure stylesheet = new DOMStructure( getStylesheet() );
    XSLTTransformParameterSpec spec = new XSLTTransformParameterSpec( stylesheet );
    transforms.add( fac.newTransform( Transform.XSLT, spec ) );
    private Element getStylesheet() throws Exception {
         String stylesheet = //"<?xml version=\"1.0\"?>" +
                        "<xslt:stylesheet version=\"1.0\" xmlns:xslt=\"http://www.w3.org/1999/XSL/Transform\">\n" +
                        " <xsl:include href=\"http://extern XSLT\" />\n" +
                        " <xslt:template match=\"/\">" +
                        " <xsl:apply-imports />" +
                        " </xslt:template>" +
                        "</xslt:stylesheet>\n";
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         //dbf.setValidating( true );
         return dbf.newDocumentBuilder().parse( new ByteArrayInputStream( stylesheet.getBytes() ) ).getDocumentElement();
    I get following exception:
    javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.dsig.TransformException: com.sun.org.apache.xml.internal.security.transforms.TransformationException: Cannot find xslt:stylesheet in Transform
    Original Exception was com.sun.org.apache.xml.internal.security.transforms.TransformationException: Cannot find xslt:stylesheet in Transform
         at org.jcp.xml.dsig.internal.dom.DOMReference.transform(Unknown Source)
         at org.jcp.xml.dsig.internal.dom.DOMReference.digest(Unknown Source)
         at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.digestReference(Unknown Source)
         at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(Unknown Source)
    In google I cannot find any details what can be wrong.
    Any suggestions?
    Thanks in advance,
    errno

    Thanks for your response. Sorry - I tried both versions with xslt and xsl - doesn't worked -> the error in my post is actually caused through the multiple changes of this part of code. Here once again:
    private Element getStylesheet() throws Exception {
              String stylesheet = //"<?xml version=\"1.0\"?>" +
                                       "<xslt:stylesheet version=\"1.0\" xmlns:xslt=\"http://www.w3.org/1999/XSL/Transform\">\n" +
                                       " <xslt:include href=\"external XSLTl\" />\n" +
                                       " <xslt:template match=\"/\">" +
                                       " <xslt:apply-imports />" +
                                       " </xslt:template>" +
                                       "</xslt:stylesheet>\n";
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              //dbf.setValidating( true );
              return dbf.newDocumentBuilder().parse( new ByteArrayInputStream( stylesheet.getBytes() ) ).getDocumentElement();
    Thanks,
    errno

Maybe you are looking for

  • Mod shows "Failed" in Addon Manager, but it works... what is wrong?

    I have two addons that are installed and working; but, the Addon Manager says they have Failed connecting.  Also, the Addons take ~15 seconds to connect, which seems a bit long to me.  I am including all my connection code. Imports Microsoft.VisualBa

  • HT1414 when changing a battery on 3gs is it really an APN no required of the old battery?

    Hi I have changed a battery on my 3gs iphone three months ago but now it it started to play up it shuts down prematurely is it anything to do with APN please see the staement below five different batteries used Apn 616.0431 apn 616.0432              

  • "Unknown error" when trying to save Flash Text

    I get the message "unkown error" every time I try to save flash text. Help topic in Dreamweaver 8 outlines the steps to take, but not what to do if it doesn't work. I followed a thread for this problem in the knowledge base, but it suddenly stopped w

  • Office Jet 8600 All in One

    My printer was working fine wirelessly when I noticed it flashing and a message to turn off and back on, which I did. All I get it what looks like a timer button on the display with a code. I have tried to reset several times and sometimes the code c

  • NoClassDefFoundError when using ServerErrorListener

    Hi, I've got a java-programm using JCo 2.1.6. I wrapped up this programm with the jsl-tool to use that programm as a windows service. Now the connection process stands still when calling addClientPool. Therefore i tried to implement the ServerErrorLi