Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem with XMLType transform

Re: Problem with XMLType transform

From: <raji_kb02_at_yahoo.co.in>
Date: 8 Mar 2006 02:57:19 -0800
Message-ID: <1141815439.454556.145840@i39g2000cwa.googlegroups.com>


Problem is with the xsl. You have used "copy-OF SELECT" instead of "copy-of select".
Following xsl works with your xml data.

create table transxml(pk number not null, xml xmltype,xsl xmltype);

insert into transxml(pk,xml,xsl) values(3, xmltype('<EIN>
<segment_id>EIN</segment_id>

    <earned_income_type>EIWA</earned_income_type>
    <employer_name>ATC TEMPE</employer_name>
    <earned_income_occurrence_cnt>01</earned_income_occurrence_cnt>
    <earned_income_amount>001360.00</earned_income_amount>
    <date_income_received>20050708</date_income_received>
    <hours_worked>000080</hours_worked>
    <earned_income_frequency_code>2</earned_income_frequency_code>

</EIN>'),

xmltype('<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml"/>
<xsl:template match="EIN">
<EIN>
<xsl:copy-of select="./segment_id"/>
<xsl:copy-of select="./employer_name"/>
<xsl:copy-of select="./earned_income_occurrence_cnt"/>
<xsl:for-each select="./earned_income_amount">
 <EIN_Gross>
 <xsl:copy-of select="."/>
 </EIN_Gross>

</xsl:for-each>
<xsl:copy-of select="./earned_income_frequency_code"/>
</EIN>
</xsl:template>
</xsl:stylesheet>'))

scott_at_ORA9.2> select x.xml.transform(x.xsl) from transxml x where pk =3;

X.XML.TRANSFORM(X.XSL)



<EIN>
  <segment_id>EIN</segment_id>
  <employer_name>ATC TEMPE</employer_name>
  <earned_income_occurrence_cnt>01</earned_income_occurrence_cnt>
  <EIN_Gross>

    <earned_income_amount>001360.00</earned_income_amount>   </EIN_Gross>
  <earned_income_frequency_code>2</earned_income_frequency_code>
</EIN>
Received on Wed Mar 08 2006 - 04:57:19 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US