MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/rdbms/xml/xsl/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/rdbms/xml/xsl/kubody.xsl

<?xml version="1.0"?>
<!--
 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
NAME
    kubody.xsl
DESCRIPTION
    XSLT stylesheet for XML => DDL conversion of type/package body ADTs
NOTES
    Do NOT modify this file under any circumstance. Copy the file
    if you wish to use this stylesheet with an external XML/XSL parser

MODIFIED        MM/DD/YY
    tbhukya     07/13/15 - Bug 21433557: Add reuse setting in alter compile body
    bwright     08/15/13 - Bug 17312600: Remove hard tabs from DP src code
    traney      08/02/12 - 14407652: [non]editionable
    lbarton     01/05/09 - bug 6269507: preserve text from source$
    lbarton     12/30/08 - Bug 7354560: procedure terminator
    lbarton     11/02/05 - Bug 4715313: reformat files for use with XMLSpy 
    htseng      12/08/03 - compiler switch support
    lbarton     11/07/03 - recompile package body 
    htseng      08/13/03 - compiler switch support 
    lbarton     04/09/03 - Bug 2844111: DoSourceLines
    htseng      12/18/02 - add EXPORT parameter
    lbarton     06/01/01 - remove oradb-style imports
    gclaborn    10/30/00 - Add external imports; change name
    lbarton     07/24/00 - use uriref in import
    lbarton     07/17/00 - bugfix: use DoTerminator
    lbarton     06/02/00 - support parsing
    lbarton     03/17/00 - Add module header
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- Import required scripts -->
 <xsl:import href="kucommon.xsl"/>
 <xsl:import href="kusource.xsl"/>
 <xsl:import href="kuproc.xsl"/>
 <!-- Top-level parameters -->
 <xsl:param name="EXPORT">0</xsl:param>
 <xsl:template match="TYPE_BODY_T | PACKAGE_BODY_T">
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">CREATE</xsl:with-param>
   <xsl:with-param name="ObjectType">
    <xsl:choose>
     <xsl:when test="local-name(.)='PACKAGE_BODY_T'">PACKAGE BODY</xsl:when>
     <xsl:when test="local-name(.)='TYPE_BODY_T'">TYPE BODY</xsl:when>
     <xsl:otherwise>**NOT FOUND** </xsl:otherwise>
    </xsl:choose>
   </xsl:with-param>
   <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
   <xsl:with-param name="NameNode" select="SCHEMA_OBJ/NAME"/>
  </xsl:call-template>
  <xsl:choose>
   <xsl:when test="local-name(.)='PACKAGE_BODY_T' and $EXPORT=1">
    <xsl:text>CREATE </xsl:text>
    <xsl:call-template name="Editionable">
     <xsl:with-param name="SchemaObjNode" select="SCHEMA_OBJ"/>
    </xsl:call-template>
    <xsl:for-each select="SOURCE_LINES/SOURCE_LINES_ITEM">
     <xsl:value-of select="SOURCE"/>
    </xsl:for-each>
   </xsl:when>
   <xsl:otherwise>
    <xsl:text>CREATE </xsl:text>
    <xsl:if test="$EXPORT=0">
     <xsl:text>OR REPLACE </xsl:text>
    </xsl:if>
    <xsl:call-template name="Editionable">
     <xsl:with-param name="SchemaObjNode" select="SCHEMA_OBJ"/>
    </xsl:call-template>
    <xsl:call-template name="BodyObjType">
     <xsl:with-param name="NodeName" select="local-name(.)"/>
    </xsl:call-template>
    <xsl:text> BODY </xsl:text>
    <xsl:apply-templates select="SCHEMA_OBJ"/>
    <xsl:choose>
     <xsl:when test="VERS_MAJOR=1 and VERS_MINOR=0">
      <xsl:apply-templates select="SOURCE_LINES">
       <xsl:with-param name="OBJTYPE">2</xsl:with-param>
      </xsl:apply-templates>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="DoSourceLines">
       <xsl:with-param name="SourceLines" select="SOURCE_LINES"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text" select="SOURCE_LINES/SOURCE_LINES_ITEM[position()=last()]/SOURCE"/>
   <xsl:with-param name="TrailingNL" select="SOURCE_LINES/SOURCE_LINES_ITEM[position()=last()]/TRAILING_NL"/>
  </xsl:call-template>
  <xsl:if test="$EXPORT=1 and COMPILER_INFO">
   <!-- switch compiler info  -->
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb">ALTER</xsl:with-param>
    <xsl:with-param name="ObjectType">
     <xsl:choose>
      <xsl:when test="local-name(.)='TYPE_BODY_T'">TYPE</xsl:when>
      <xsl:when test="local-name(.)='PACKAGE_BODY_T'">PACKAGE_BODY</xsl:when>
      <xsl:otherwise>**NOT FOUND** </xsl:otherwise>
     </xsl:choose>
    </xsl:with-param>
    <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
    <xsl:with-param name="NameNode" select="SCHEMA_OBJ/NAME"/>
   </xsl:call-template>
   <xsl:text>&#xa;</xsl:text>
   <xsl:text>ALTER </xsl:text>
   <xsl:call-template name="ProcObjType">
    <xsl:with-param name="NodeName" select="local-name(.)"/>
   </xsl:call-template>
   <xsl:text> </xsl:text>
   <xsl:apply-templates select="SCHEMA_OBJ"/>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <xsl:text>  COMPILE </xsl:text>
   <xsl:call-template name="COMPILER_SWITCH"/>
   <!-- For data pump import of package bodies, do a recompile -->
   <!-- switch compiler info  -->
   <xsl:if test="local-name(.)='PACKAGE_BODY_T' or 
                 local-name(.)='TYPE_BODY_T'">
    <xsl:text> REUSE SETTINGS TIMESTAMP '</xsl:text>
    <xsl:value-of select="SCHEMA_OBJ/MTIME"/>
    <xsl:text>'</xsl:text>
   </xsl:if>
   <xsl:if test="$SQLTERMINATOR=1">
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>/</xsl:text>
    <!-- Terminate the SQL statement -->
   </xsl:if>
  </xsl:if>
 </xsl:template>
 <xsl:template name="BodyObjType">
  <xsl:param name="NodeName" select="''"/>
  <xsl:choose>
   <xsl:when test="$NodeName='PACKAGE_BODY_T'">PACKAGE</xsl:when>
   <xsl:when test="$NodeName='TYPE_BODY_T'">TYPE</xsl:when>
   <xsl:otherwise>**NOT FOUND** </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO