Forum Stats

  • 3,771,062 Users
  • 2,253,216 Discussions
  • 7,875,729 Comments

Discussions

Is there is behavior change using XMLTRANSFORM in 19C

Scottfry S.
Scottfry S. Member Posts: 1 Green Ribbon

We have been chasing down a compilation error on our newly upgraded 19C server we think we have it narrowed down the XMLTRANSFORM function. Please take the follow code snippet on 12C.

SQL> with

 params_ as

 (

    select q'[<xsl:stylesheet version="1.0"

             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

             xmlns="http://schemas.xmlsoap.org/soap/envelope/"

             xmlns:m="http://markets.midwestiso.org/dart/xml">

      <xsl:template match="/">

        <xsl:for-each select="//m:SubmitActivity">

          <xsl:for-each select="m:Function">

           <xsl:for-each select="m:Invocation">

             <xsl:for-each select="m:Parameter">

              <xsl:variable name="tradedate" select="@value"/>

             </xsl:for-each>

             <xsl:value-of select="concat($tradedate)"/>

             <xsl:text>&#xA;</xsl:text>

           </xsl:for-each>

          </xsl:for-each>

        </xsl:for-each>

      </xsl:template>

      </xsl:stylesheet>]' v_xsltdoc,

q'[<?xml version="1.0" encoding="UTF-8"?>

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">

  <Body>

        <QueryResponse xmlns="http://markets.midwestiso.org/dart/xml">

      <SubmitActivity>

        <Function name="VirtualBid">

          <Invocation>

            <Parameter name="Day" value="testDATE"/>

          </Invocation>

        </Function>

      </SubmitActivity>

    </QueryResponse>

  </Body>

</Envelope>

]' v_xmlclob

 from dual

 )

select xmltransform(xmltype(v_xmlclob), xmltype(v_xsltdoc))

 from params_;  


XMLTRANSFORM(XMLTYPE(V_XMLCLOB),XMLTYPE(V_XSLTDOC))

------------------------------------------------------------------------------------------------------------------------------------------------------

testDATE


SQL>

And then we do the same exact query on 19C.

SQL> with

 params_ as

 (

    select q'[<xsl:stylesheet version="1.0"

             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

             xmlns="http://schemas.xmlsoap.org/soap/envelope/"

             xmlns:m="http://markets.midwestiso.org/dart/xml">

      <xsl:template match="/">

        <xsl:for-each select="//m:SubmitActivity">

           <xsl:for-each select="m:Function">

           <xsl:for-each select="m:Invocation">

             <xsl:for-each select="m:Parameter">

              <xsl:variable name="tradedate" select="@value"/>

             </xsl:for-each>

             <xsl:value-of select="concat($tradedate)"/>

             <xsl:text>&#xA;</xsl:text>

         </xsl:for-each>

          </xsl:for-each>

         </xsl:for-each>

      </xsl:template>

      </xsl:stylesheet>]' v_xsltdoc,

q'[<?xml version="1.0" encoding="UTF-8"?>

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">

  <Body>

        <QueryResponse xmlns="http://markets.midwestiso.org/dart/xml">

      <SubmitActivity>

        <Function name="VirtualBid">

          <Invocation>

            <Parameter name="Day" value="testDATE"/>

           </Invocation>

        </Function>

      </SubmitActivity>

    </QueryResponse>

  </Body>

</Envelope>

]' v_xmlclob

 from dual

  )

select xmltransform(xmltype(v_xmlclob), xmltype(v_xsltdoc))

 from params_; 39  40

ERROR:

ORA-31011: XML parsing failed

ORA-19202: Error occurred in XML processing

LPX-00607: Invalid reference: 'tradedate'.


no rows selected


SQL>


Seems pretty basic but we are stumped. We also sadly use calls like this in a variety of places so we need to address this before moving to 19C. Any help would be appreciated... I'm guessing this may be a syntax change where some feature we are using h

Comments

  • cormaco
    cormaco Member Posts: 1,731 Bronze Crown

    It seems to me that the way local variables are treated has changed:

    In earlier versions all variables were treated as global, so you were able to access them outside their scope.

    In Oracle 19 local variables are treated stricly as local and cannot be accessed from outside their scope anymore.