MINI MINI MANI MO
<?xml version="1.0"?>
<!--
Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
NAME
kulib.xsl
DESCRIPTION
XSLT stylesheet for XML => DDL conversion of ku$_library_t 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
bwright 08/15/13 - Bug 17312600: Remove hard tabs from DP src code
traney 08/02/12 - 14407652: [non]editionable
rapayne 04/20/12 - proj 39632: enhancements to create library
include DIRECTORY, AGENT, and CREDENTIALs.
lbarton 11/02/05 - Bug 4715313: reformat files for use with XMLSpy
htseng 12/18/02 - add EXPORT parameter
htseng 08/02/02 - add grantee parse param
htseng 07/26/02 - add more parse params
htseng 09/19/01 - Merged htseng_add_xsl_stylesheets
htseng 04/17/01 - Creation
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Import required scripts -->
<xsl:import href="kucommon.xsl"/>
<!-- Top-level parameters -->
<xsl:param name="PRETTY">1</xsl:param>
<xsl:param name="SQLTERMINATOR">1</xsl:param>
<xsl:param name="EXPORT">0</xsl:param>
<!-- params for parse -->
<xsl:param name="PRS_DDL">0</xsl:param>
<xsl:param name="PRS_DELIM">\{]`</xsl:param>
<xsl:param name="PRS_VERB">0</xsl:param>
<xsl:param name="PRS_OBJECT_TYPE">0</xsl:param>
<xsl:param name="PRS_SCHEMA">0</xsl:param>
<xsl:param name="PRS_NAME">0</xsl:param>
<xsl:param name="PRS_GRANTEE">0</xsl:param>
<xsl:param name="PRS_GRANTOR">0</xsl:param>
<xsl:param name="PRS_BASE_OBJECT_TYPE">0</xsl:param>
<xsl:param name="PRS_BASE_OBJECT_SCHEMA">0</xsl:param>
<xsl:param name="PRS_BASE_OBJECT_NAME">0</xsl:param>
<xsl:template match="LIBRARY_T">
<xsl:call-template name="DoParse">
<xsl:with-param name="Verb">CREATE</xsl:with-param>
<xsl:with-param name="ObjectType">LIBRARY</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> 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:text>LIBRARY </xsl:text>
<xsl:apply-templates select="SCHEMA_OBJ"/>
<xsl:choose>
<!-- 0x01 = STATIC, 0x02 = TRUSTED -->
<xsl:when test="PROPERTY mod 4 > 1 ">
<xsl:text>TRUSTED </xsl:text>
<xsl:if test="PROPERTY mod 2 = 1">
<xsl:text>AS STATIC </xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<!-- UNTRUSTED_CLAUSE -->
<!-- generate appropriate STATIC directive -->
<xsl:choose>
<xsl:when test="PROPERTY mod 2 = 1">
<!-- pre-12g format -->
<xsl:text>UNTRUSTED AS STATIC </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>UNTRUSTED AS </xsl:text>
<xsl:call-template name="DoUntrustedClause">
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$SQLTERMINATOR=1">
<xsl:text>;</xsl:text>
<!-- Terminate the SQL statement -->
</xsl:if>
</xsl:template>
<xsl:template name="DoUntrustedClause">
<!-- *******************************************************************
Template: DoUntrustedClause
Description:
v12 format: AGENT CREDENTIAL DIROBJ [filname || filespec]
pre-v12 format: filespec
Parameters: None
******************************************************************** -->
<xsl:choose>
<xsl:when test="$VERSION>=1200000000">
<xsl:choose>
<xsl:when test="DIRECTORY and FILENAME">
<xsl:call-template name="SingleQuotedName">
<xsl:with-param name="NameNode" select="FILENAME"/>
</xsl:call-template>
<xsl:text> IN </xsl:text>
<xsl:call-template name="QuoteObject">
<xsl:with-param name="Object" select="DIRECTORY"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="FILESPEC">
<xsl:call-template name="SingleQuotedName">
<xsl:with-param name="NameNode" select="FILESPEC"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<!-- generate AGENT qualifier if apporpriate -->
<xsl:if test="AGENT">
<xsl:text> AGENT </xsl:text>
<xsl:call-template name="SingleQuotedName">
<xsl:with-param name="NameNode" select="AGENT"/>
</xsl:call-template>
</xsl:if>
<!-- generate CREDENTIAL qualifier if apporpriate -->
<xsl:if test="CREDENTIAL">
<xsl:text> CREDENTIAL </xsl:text>
<xsl:call-template name="QuoteObject">
<xsl:with-param name="Schema" select="CREDENTIAL/SCHEMA_OBJ/OWNER_NAME"/>
<xsl:with-param name="Object" select="CREDENTIAL/SCHEMA_OBJ/NAME"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="SingleQuotedName">
<xsl:with-param name="NameNode" select="FILESPEC"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
OHA YOOOO