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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Oracle XPATH question

RE: Oracle XPATH question

From: Davey, Alan <ddavey_at_harris.com>
Date: Fri, 17 Mar 2006 13:21:51 -0500
Message-ID: <A223847B255BF54FBE6AFEEF58F0C16F01C27591@mlbe2k6.cs.myharris.net>


Christian and others,

Thank you for the feedback. This may not be the best solution, but by using XSLT I can get the results I was looking for:

SELECT XMLTRANSFORM

          (xmltype(a.xml_content),
           XMLTYPE
              ('<?xml version="1.0" ?>
             <xsl:stylesheet version="1.0"
 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
               <xsl:template match="/">
<xsl:for-each select="TAM/SI">

<posn><xsl:value-of select="position()"/></posn>
<station><xsl:value-of select="station"/></station>
<program><xsl:value-of select="programname"/></program>
... </xsl:for-each> </xsl:template> </xsl:stylesheet>' ) )

  FROM BR_GTT_AVAIL_IMPORT a

The output of this can then be wrapped with another select statement to produce the records and columns I was originally after. The beauty of this approach is that since I have to deal with two radically different XML files containing similar data, I can dynamically choose the correct template at run time and the outer select statement will still return the correct result set.

The only possible flaw I can see with this approach would be if the xsl:for-each didn't process nodes sequentially. This seems unlikely, but if someone knows otherwise, please let me know.

Regards,

Alan Davey

-----Original Message-----
From: Christian Antognini [mailto:Christian.Antognini_at_trivadis.com] Sent: Thursday, March 16, 2006 5:25 PM
To: Davey, Alan
Cc: oracle-l_at_freelists.org
Subject: RE: Oracle XPATH question

Alan

<snip>

If you find a good solution, please, let me know.

Regards,
Chris

PS: 3 years ago I posted a very similar answer... (see http://forums.oracle.com/forums/thread.jspa?messageID=406376&#406376) eventually in 3 years I'll know how to do it.

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 17 2006 - 12:21:51 CST

Original text of this message

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