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/kuntab.xsl

<?xml version="1.0"?>
<!-- 
 Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
NAME
    kuntab.xsl
DESCRIPTION
    XSLT stylesheet for XML => DDL conversion of nested tables
    (broken out of kutable.xsl for code hygiene)
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
    jjanosik     07/14/17 - Bug 26303869: support read only nested tables
    jjanosik     05/25/17 - Bug 25673825: Handle compression on nested tables
    rapayne      02/12/17 - Fix deferred storage for nested tables.
    sdavidso    12/12/16 - Pass FullName for ALTER TABLE xxx ADD CONSTRAINT
    rapayne     01/30/16 - bug 22611512: fix variable Transportable
    tbhukya     01/05/15 - Bug 20319428: Declare referred params
    mjangir     12/03/12 - bug 14835322: emit compress
    lbarton     12/28/11 - 36954_dpump_tabcluster_zonemap
    sdavidso    08/08/11 - FORCE_UNIQUE transform support
    sdavidso    03/30/11 - support TRANSPORTABLE xml element
    sdavidso    12/21/10 - Bug 9945136: incorrect default tablespace
    sdavidso    10/21/10 - lrg4901374: nested tables of hash partitioned tables
                          cannot have defaults
    sdavidso    09/23/10 - bug10101332: fix nested table/part attributes
    lbarton     10/22/08 - bug 7503865: GLOBAL keyword in
                           nested_table_col_properties
    htseng      05/21/07 - bug 5451654
    lbarton     01/20/06 - partition transportable 
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- Top level imports -->
 <xsl:import href="kucommon.xsl"/>
 <xsl:import href="kutabcon.xsl"/>
 <xsl:import href="kuiot.xsl"/>
 <xsl:import href="kulob.xsl"/>
 <!-- Top level params -->
 <xsl:param name="SEGMENT_ATTRIBUTES">1</xsl:param>
 <xsl:param name="PCTSPACE">100</xsl:param>
 <xsl:param name="TABLESPACE">1</xsl:param>
 <xsl:param name="PARTITION_NAME" select="''"/>
 <xsl:param name="SUBPARTITION_NAME" select="''"/>
 <xsl:param name="TRANSPORTABLE">0</xsl:param>
 <!-- Templates -->
 <xsl:template match="NT">
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="ParentProperty">0</xsl:param>
  <xsl:param name="DoingTable">1</xsl:param>
  <xsl:param name="Parttype" select="''"/>
  <!-- *******************************************************************
Template: NT - Top-level nested table only.
       NT - parent node: NT/NTS is the list of nested tables
         NT/NTS occurs both as an element of TABLE_T and PART_LIST_ITEM
         for each partition (of the parent table)
Parameters:
  Pctspace - value of the PCTSPACE param; defaults to 100
  DoingTable - 1 if we are at the table level, 0 if at the partition level
  Parttype - the partition type of the parent table (only at partition level)
******************************************************************** -->
  <xsl:call-template name="DoNTStoreAs">
   <xsl:with-param name="Node" select="NTS"/>
   <xsl:with-param name="ParentObjNum" select="OBJ_NUM"/>
   <xsl:with-param name="ParentProperty" select="$ParentProperty"/>
   <xsl:with-param name="DoingTable" select="$DoingTable"/>
   <xsl:with-param name="Pctspace" select="$Pctspace"/>
   <xsl:with-param name="Parttype" select="$Parttype"/>
  </xsl:call-template>
 </xsl:template>
 <!-- All levels of Nested Table -->
 <xsl:template name="DoNTStoreAs">
  <xsl:param name="Node" select="''"/>
  <xsl:param name="ParentObjNum">0</xsl:param>
  <xsl:param name="ParentProperty">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="DoingTable">1</xsl:param>
  <xsl:param name="Parttype" select="''"/>
  <!-- *******************************************************************
Template: DoNTStoreAs
Parameters:
  Node - parent node of NTS_ITEM
  ParentObjNum - object number of parent table of nested tables
  ParentProperty - Table property (when DoingTable=1)
  Pctspace - value of the PCTSPACE param; defaults to 100
  Parttype - the partition type of the parent table (only at partition level)
  DoingTable - 1 if we are at the table level, 0 if at the partition level
******************************************************************* -->
  <!-- bug 4347010: skip unused columns -->
  <xsl:for-each select="$Node/NTS_ITEM[OBJ_NUM=$ParentObjNum and
              (32768 > (COL/PROPERTY mod 65536))]">
   <xsl:sort select="INTCOL_NUM" data-type="number"/>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <!-- say 'varray' or 'nested table'-->
   <xsl:choose>
    <!-- column is varray stored as table -->
    <xsl:when test="COL/TYPE_NUM='123'">
     <xsl:text> VARRAY </xsl:text>
     <xsl:call-template name="ColNameOrAttr">
      <xsl:with-param name="ColItem" select="COL"/>
     </xsl:call-template>
     <xsl:text> STORE AS TABLE </xsl:text>
    </xsl:when>
    <!-- column is nested table type;
         putting this code in the otherwise-tag
         allows this to work for 9.0 xml docs.
         Those docs don't have a COL/TYPE_NUM element.
         (Varrays stored as tables were not supported before 9.2
         so there was no need for a COL/TYPE_NUM element.) -->
    <xsl:otherwise>
     <xsl:text> NESTED TABLE </xsl:text>
     <xsl:call-template name="ColNameOrAttr">
      <xsl:with-param name="ColItem" select="COL"/>
     </xsl:call-template>
     <!-- GLOBAL/LOCAL keyword introduced in 11.1.0.7:
            PROPERTY bit is
             0x20 -  partitioned table
       LOCAL is default when parent table is partitioned.
       Specify GLOBAL if needed to override default 
        (i.e., when parent table is partitioned and nested table is not) -->
     <xsl:if test="$VERSION>=1101000700 and
                         (($ParentProperty mod 64)>=32) and 
                         ($DoingTable=1) and 
                         (32 > (PROPERTY mod 64))"> GLOBAL</xsl:if>
     <xsl:text> STORE AS </xsl:text>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:choose>
    <xsl:when test="$FORCE_UNIQUE=1">
     <xsl:value-of select='"KU$"'/>
     <xsl:value-of select="NTAB_NUM"/>
     <xsl:value-of select='"NT"'/>
     <xsl:value-of select="INTCOL_NUM"/>
    </xsl:when>
    <xsl:when test="$DoingTable=1">
     <xsl:call-template name="QuoteObject">
      <xsl:with-param name="Schema" select="''"/>
      <xsl:with-param name="Object" select="SCHEMA_OBJ/NAME"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:text>"</xsl:text>
     <xsl:value-of select="SCHEMA_OBJ/SUBNAME"/>
     <xsl:text>"</xsl:text>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
   </xsl:if>
   <!--Build the storage clause
 - If it is not empty, include it with parens-->
   <xsl:variable name="IsNotHash">
    <!--Test for hash partitioning (hash is type 2; non partitioned tables have no parttype)-->
    <xsl:choose>
     <xsl:when test="not($Parttype) or ($Parttype != 2)">
      <xsl:text>1</xsl:text>
     </xsl:when>
     <xsl:otherwise>
      <xsl:text>0</xsl:text>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:variable>
   <xsl:variable name="StoragClause">
    <!-- Emit non constraint storage properties -->
    <xsl:choose>
     <xsl:when test="(PROPERTY mod 128)>=64">
      <!-- IOT -->
      <xsl:text> ORGANIZATION INDEX PCTTHRESHOLD </xsl:text>
      <xsl:value-of select="IONT/PCT_THRESH"/>
      <xsl:if test="$PRETTY=1">
       <xsl:text>&#xa;</xsl:text>
      </xsl:if>
      <xsl:text> </xsl:text>
      <!-- 
        If departitioning doesn't generate COMPRESS
        value will come from partition   -->
      <xsl:if test="string-length($PARTITION_NAME)=0 and
                    string-length($SUBPARTITION_NAME)=0">
       <xsl:choose>
        <xsl:when test="IONT/NUMKEYCOLS>0">
         <xsl:text>COMPRESS </xsl:text>
         <xsl:value-of select="IONT/NUMKEYCOLS"/>
         <xsl:text> </xsl:text>
        </xsl:when>
        <xsl:otherwise>NOCOMPRESS </xsl:otherwise>
       </xsl:choose>
      </xsl:if>
      <xsl:if test="$SEGMENT_ATTRIBUTES=1">
       <xsl:apply-templates select="IONT/PCT_FREE">
        <xsl:with-param name="ADT_type">INDEX</xsl:with-param>
       </xsl:apply-templates>
      </xsl:if>
     </xsl:when>
     <xsl:otherwise>
      <xsl:if test="$SEGMENT_ATTRIBUTES=1 and ($IsNotHash=1)">
       <xsl:choose>
        <!-- if this is equipartitioned table (i.e., nested table is partititoned)
 and we are not doing a partition
 then emit default values -->
        <xsl:when test="((HNT/PROPERTY) mod 64)>=32 and $DoingTable=1">
         <!--For heap partitioned tables, defaults are not allowed.-->
         <xsl:apply-templates select="HNT/PARTOBJ/DEFPCTFREE"/>
        </xsl:when>
        <!-- if not equipartitioned, emit table storage parameters-->
        <xsl:otherwise>
         <xsl:apply-templates select="HNT/PCT_FREE"/>
        </xsl:otherwise>
       </xsl:choose>
      </xsl:if>
     </xsl:otherwise>
    </xsl:choose>
    <xsl:if test="$SEGMENT_ATTRIBUTES=1">
     <!--Most segment attributes may not be specified for hash partitioned tables (or equipartitioned 
nested tables thereof)-->
     <xsl:if test="$IsNotHash=1">
      <xsl:call-template name="DoLogging">
       <xsl:with-param name="FlagsNode" select="(HNT | IONT)/FLAGS"/>
      </xsl:call-template>
      <xsl:apply-templates select="IONT/STORAGE">
       <xsl:with-param name="Nested">1</xsl:with-param>
       <xsl:with-param name="BlkSize" select="IONT/BLOCKSIZE"/>
       <xsl:with-param name="Dataobjnum" select="IONT/STORAGE/HWMINCR"/>
       <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
      </xsl:apply-templates>
      <!-- IOT nested tables can not have deferred storage -->
      <xsl:choose>
       <xsl:when test="HNT/DEFERRED_STG">
        <xsl:call-template name="DoDeferredStg">
         <xsl:with-param name="DeferredStg" select="HNT/DEFERRED_STG"/>
         <xsl:with-param name="Pctspace" select="$Pctspace"/>
         <xsl:with-param name="ADT_type">TABLE</xsl:with-param>
         <xsl:with-param name="doLogging">0</xsl:with-param>
         <xsl:with-param name="doCompression">1</xsl:with-param>
         <xsl:with-param name="BlkSize" select="HNT/BLOCKSIZE"/>
        </xsl:call-template>
       </xsl:when>
       <xsl:when test="HNT/STORAGE">
       <!-- nested table storage; if nested table is an IOT, dataobj#
is stored in STORAGE/HWMINCR -->
        <xsl:apply-templates select="HNT/STORAGE">
         <xsl:with-param name="Nested">1</xsl:with-param>
         <xsl:with-param name="BlkSize" select="HNT/BLOCKSIZE"/>
         <xsl:with-param name="Dataobjnum" select="SCHEMA_OBJ/DATAOBJ_NUM"/>
         <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
        </xsl:apply-templates>
        <xsl:call-template name="DoSegCompress">
         <xsl:with-param name="Compress" select="HNT/STORAGE/FLAGS"/>
        </xsl:call-template>
       </xsl:when>
      </xsl:choose>
     </xsl:if>
     <xsl:if test="$VERSION>=1000000000 and $TABLESPACE=1">
      <!-- Nested table tablespace -->
      <xsl:choose>
       <!-- if this is equipartitioned table (i.e., nested table is partititoned)
 and we are not doing a partition
 then emit default values -->
       <xsl:when test="((HNT/PROPERTY) mod 64)>=32 and $DoingTable=1">
        <!--For heap partitioned tables, defaults are not allowed.-->
        <xsl:if test="string-length(HNT/PARTOBJ/DEFTS_NAME)!=0">
         <xsl:if test="$PRETTY=1">
          <xsl:text>&#xa; </xsl:text>
         </xsl:if>
         <xsl:text> TABLESPACE "</xsl:text>
         <xsl:value-of select="HNT/PARTOBJ/DEFTS_NAME"/>
         <xsl:text>" </xsl:text>
        </xsl:if>
       </xsl:when>
       <!-- if not equipartitioned, emit table storage parameters-->
       <xsl:otherwise>
        <xsl:if test="string-length(HNT/TS_NAME)!=0">
         <xsl:if test="$PRETTY=1">
          <xsl:text>&#xa; </xsl:text>
         </xsl:if>
         <xsl:text> TABLESPACE "</xsl:text>
         <xsl:value-of select="HNT/TS_NAME"/>
         <xsl:text>" </xsl:text>
        </xsl:if>
        <xsl:if test="string-length(IONT/TS_NAME)!=0">
         <xsl:if test="$PRETTY=1">
          <xsl:text>&#xa; </xsl:text>
         </xsl:if>
         <xsl:text> TABLESPACE "</xsl:text>
         <xsl:value-of select="IONT/TS_NAME"/>
         <xsl:text>" </xsl:text>
        </xsl:if>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:if>
    </xsl:if>
    <xsl:if test="(PROPERTY mod 256)>=128">
     <!-- IOV -->
     <xsl:call-template name="DoIOV">
      <xsl:with-param name="Node" select="IONT"/>
      <xsl:with-param name="Nested">1</xsl:with-param>
      <xsl:with-param name="Pctspace" select="$Pctspace"/>
     </xsl:call-template>
    </xsl:if>
    <!-- clustering -->
    <xsl:apply-templates select="CLST"/>
    <!-- row movement if not varray or partitioned -->
    <xsl:if test="COL/TYPE_NUM!='123' and not($Parttype)">
     <xsl:if test="(HNT/FLAGS mod 262144) >= 131072">
      <xsl:text> ENABLE ROW MOVEMENT </xsl:text>
     </xsl:if>
    </xsl:if>
    <!-- cellmemory clause for immediate or deferred -->
    <xsl:choose>
     <xsl:when test="HNT/STORAGE">
      <xsl:call-template name="DoCMemoryCompress">
       <xsl:with-param name="CMCompress" select="HNT/STORAGE/FLAGS2"/>
      </xsl:call-template>
     </xsl:when>
     <xsl:when test="HNT/DEFERRED_STG">
      <xsl:variable name="CMCompress" select="HNT/DEFERRED_STG/CCFLAG_STG"/>
       <!-- 8194  - CELLMEMORY enabled
            8196  - MEMCOMPRESS FOR QUERY
            8200  - MEMCOMPRESS FOR CAPACITY
           16384  - NO CELLMEMORY -->
      <xsl:variable name="flagNoCMemory">16384</xsl:variable>
      <xsl:variable name="flagCMemory">8192</xsl:variable>
      <xsl:variable name="flagCMCompressQuery">4</xsl:variable>
      <xsl:variable name="flagCMCompressCapacity">8</xsl:variable>
      <xsl:variable name="isCMemory" select="($CMCompress mod ($flagCMemory*2)>=$flagCMemory)"/>
      <xsl:call-template name="DoCMemoryCompressSyntax">
       <xsl:with-param name="isNoCMemory" select="($CMCompress mod ($flagNoCMemory*2)>=$flagNoCMemory)"/>
       <xsl:with-param name="isCMemory" select="$isCMemory"/>
       <xsl:with-param name="isCMCompressQuery" select="$isCMemory and ($CMCompress mod ($flagCMCompressQuery*2)>=4)"/>
       <xsl:with-param name="isCMCompressCapacity" select="$isCMemory and ($CMCompress mod ($flagCMCompressCapacity*2)>=8)"/>
      </xsl:call-template>
     </xsl:when>
    </xsl:choose>
    <!-- inmemory clause, template handles storage type -->
    <xsl:call-template name="DoSegInMemory">
     <xsl:with-param name="Root" select="HNT"/>
    </xsl:call-template>
    <!-- read only -->
    <xsl:if test="(TRIGFLAG mod (2097152*2)) >= 2097152">
      <xsl:text> READ ONLY </xsl:text>
    </xsl:if>
    <!-- LOB, VARRAY AS LOB -->
    <!--  PROPERTY bits:     16 = has array columns (VARRAY)
                       2048 = has internal LOB columns
                     262144 = has user-defined LOB columns
 -->
    <xsl:if test="((PROPERTY mod 32)>=16 or
                 (PROPERTY mod 4096)>=2048 or
                 (PROPERTY mod 524288)>=262144)">
     <xsl:call-template name="DoLOBCols">
      <xsl:with-param name="MetaType">
       <xsl:choose>
        <xsl:when test="(PROPERTY mod 64)>=32">PartLob</xsl:when>
        <xsl:otherwise>Lob</xsl:otherwise>
       </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="TabBlocksize" select="(HNT | IONT)/BLOCKSIZE"/>
     </xsl:call-template>
    </xsl:if>
    <!-- call self recursively if this NT contains NTs -->
    <xsl:if test="$Node/NTS_ITEM[OBJ_NUM=current()/NTAB_NUM]">
     <xsl:call-template name="DoNTStoreAs">
      <xsl:with-param name="Node" select="$Node"/>
      <xsl:with-param name="ParentObjNum" select="NTAB_NUM"/>
      <xsl:with-param name="DoingTable" select="$DoingTable"/>
     </xsl:call-template>
    </xsl:if>
   </xsl:variable>
   <xsl:if test="not(string-length($StoragClause)=0)">
    <xsl:call-template name="EmitParen">
     <xsl:with-param name="OpenParen">1</xsl:with-param>
    </xsl:call-template>
   </xsl:if>
   <!-- Emit any needed constraints, inside separate parens -->
   <xsl:variable name="IsIOT">
    <xsl:choose>
     <xsl:when test="IONT">1</xsl:when>
     <xsl:otherwise>0</xsl:otherwise>
    </xsl:choose>
   </xsl:variable>
   <xsl:call-template name="NTabDoGenConstraints">
    <xsl:with-param name="InColList">1</xsl:with-param>
    <xsl:with-param name="IsIOT" select="$IsIOT"/>
   </xsl:call-template>
   <!-- emit storage clause -->
   <xsl:if test="not(string-length($StoragClause)=0)">
    <xsl:value-of select="$StoragClause"/>
    <xsl:call-template name="EmitParen">
     <xsl:with-param name="OpenParen">0</xsl:with-param>
    </xsl:call-template>
   </xsl:if>
   <!--  and, 'return as locator/value'-->
   <xsl:choose>
    <xsl:when test="(FLAGS mod 64)>=32">RETURN AS LOCATOR</xsl:when>
    <xsl:otherwise>RETURN AS VALUE</xsl:otherwise>
   </xsl:choose>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="GenNestedTableConstraints">
  <xsl:param name="ListParent" select="''"/>
  <xsl:param name="FullName" select='""'/>
  <!-- *******************************************************************
Template: GenNestedTableConstraints
  Nested Table Constraints (when generated as ALTER TABLE)
Parameters:
  ListParent - parent of NTS_ITEM
******************************************************************** -->
  <!-- Determine whether this is a transportable mode convert.
      See kutable.xsl for more details.
 -->
  <xsl:variable name="Transportable">
   <xsl:choose>
    <xsl:when test="$TRANSPORTABLE = 0">0</xsl:when>
    <xsl:when test="$TRANSPORTABLE = 1">1</xsl:when>
    <xsl:when test='$TRANSPORTABLE = 2 and 
              not(/ROWSET/ROW/TABLE_T/VIEW_AS_TABLE) and 
              .//TRANSPORTABLE="1"'>1</xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:for-each select="$ListParent/NTS_ITEM">
   <xsl:sort select="INTCOL_NUM" data-type="number"/>
   <xsl:variable name="IsIOT">
    <xsl:call-template name="fnIsIOT">
     <xsl:with-param name="Property" select="PROPERTY"/>
    </xsl:call-template>
   </xsl:variable>
   <xsl:call-template name="NTabDoGenConstraints">
    <xsl:with-param name="InColList">0</xsl:with-param>
    <xsl:with-param name="IsIOT" select="$IsIOT"/>
    <xsl:with-param name="FullName" select="SCHEMA_OBJ/NAME"/>
   </xsl:call-template>
   <!-- For transportable, ENABLE Hidden (OID or SETID) constrs -->
   <xsl:if test="$Transportable=1">
    <xsl:choose>
     <xsl:when test="$IsIOT=1">
      <xsl:for-each select="IONT/CON1_LIST/CON1_LIST_ITEM[OID_OR_SETID!=0]">
       <xsl:if test="$PRETTY=1">
        <xsl:text>&#xa;  </xsl:text>
       </xsl:if>
       <xsl:call-template name="DoHiddenConstraint">
        <xsl:with-param name="SchemaObjParent" select="../../.."/>
        <xsl:with-param name="ConstraintNode" select="current()"/>
       </xsl:call-template>
      </xsl:for-each>
     </xsl:when>
     <xsl:otherwise>
      <xsl:for-each select="HNT/CON1_LIST/CON1_LIST_ITEM[OID_OR_SETID!=0]">
       <xsl:if test="$PRETTY=1">
        <xsl:text>&#xa;  </xsl:text>
       </xsl:if>
       <xsl:call-template name="DoHiddenConstraint">
        <xsl:with-param name="SchemaObjParent" select="../../.."/>
        <xsl:with-param name="ConstraintNode" select="current()"/>
       </xsl:call-template>
      </xsl:for-each>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:if>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="NTabDoGenConstraints">
  <xsl:param name="InColList">0</xsl:param>
  <xsl:param name="IsIOT">0</xsl:param>
  <xsl:param name="FullName" select='""'/>
  <!-- *******************************************************************
Template: NTabDoGenConstraints - common code
Parameters:
  InColList - 1 = generating constraints after column list in CREATE TABLE
              0 = adding constraint in ALTER TABLE
  IsIOT - 1 = table is IOT
******************************************************************** -->
  <!-- get useful variables -->
  <xsl:variable name="Nested">1</xsl:variable>
  <xsl:variable name="IsObjectTable">
   <xsl:call-template name="fnIsObjectTable">
    <xsl:with-param name="Property" select="PROPERTY"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasPkOID">
   <xsl:call-template name="fnHasPkOID">
    <xsl:with-param name="Property" select="PROPERTY"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasNotNull">
   <xsl:call-template name="fnHasNotNull">
    <xsl:with-param name="SchemaObjParent" select="current()"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasNonZeroPkRef">
   <xsl:choose>
    <xsl:when test="$IsIOT=1">
     <xsl:call-template name="fnHasNonZeroPkRef">
      <xsl:with-param name="ListParent" select="IONT"/>
      <xsl:with-param name="InColList" select="$InColList"/>
      <xsl:with-param name="Nested" select="$Nested"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="fnHasNonZeroPkRef">
      <xsl:with-param name="ListParent" select="HNT"/>
      <xsl:with-param name="InColList" select="$InColList"/>
      <xsl:with-param name="Nested" select="$Nested"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:variable name="IsRefPartitioned">0</xsl:variable>
  <xsl:variable name="HasRefPartitionedChildren">0</xsl:variable>
  <xsl:variable name="IsDimensionTarget">0</xsl:variable>
  <xsl:variable name="HasCON0Constraints">
   <xsl:choose>
    <xsl:when test="$IsIOT=1">
     <xsl:call-template name="fnHasCON0Constraints">
      <xsl:with-param name="ListParent" select="IONT"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="fnHasCON0Constraints">
      <xsl:with-param name="ListParent" select="HNT"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:variable name="HasCON1Constraints">
   <xsl:choose>
    <xsl:when test="$IsIOT=1">
     <xsl:call-template name="fnHasCON1Constraints">
      <xsl:with-param name="ListParent" select="IONT"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="fnHasCON1Constraints">
      <xsl:with-param name="ListParent" select="HNT"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:variable name="HasCON2Constraints">
   <xsl:choose>
    <xsl:when test="$IsIOT=1">
     <xsl:call-template name="fnHasCON2Constraints">
      <xsl:with-param name="ListParent" select="IONT"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="fnHasCON2Constraints">
      <xsl:with-param name="ListParent" select="HNT"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:variable name="HasTableProperties">
   <xsl:call-template name="fnHasTableProperties">
    <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
    <xsl:with-param name="IsIOT" select="$IsIOT"/>
    <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
    <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
    <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
    <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
    <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
    <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
    <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
    <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
    <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="CommaNeeded">0</xsl:variable>
  <xsl:if test="$HasTableProperties=1 and $InColList=1">
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">1</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:if>
  <xsl:choose>
   <xsl:when test="$IsIOT=1">
    <xsl:call-template name="GenTableConstraints">
     <xsl:with-param name="SchemaObjParent" select="current()"/>
     <xsl:with-param name="ListParent" select="IONT"/>
     <xsl:with-param name="InColList" select="$InColList"/>
     <xsl:with-param name="CommaNeeded" select="$CommaNeeded"/>
     <xsl:with-param name="Property" select="PROPERTY"/>
     <xsl:with-param name="Nested" select="$Nested"/>
     <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
     <xsl:with-param name="IsIOT" select="$IsIOT"/>
     <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
     <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
     <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
     <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
     <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
     <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
     <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
     <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
     <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
     <xsl:with-param name="FullName" select="$FullName"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="GenTableConstraints">
     <xsl:with-param name="SchemaObjParent" select="current()"/>
     <xsl:with-param name="ListParent" select="HNT"/>
     <xsl:with-param name="InColList" select="$InColList"/>
     <xsl:with-param name="CommaNeeded" select="$CommaNeeded"/>
     <xsl:with-param name="Property" select="PROPERTY"/>
     <xsl:with-param name="Nested" select="$Nested"/>
     <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
     <xsl:with-param name="IsIOT" select="$IsIOT"/>
     <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
     <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
     <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
     <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
     <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
     <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
     <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
     <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
     <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
     <xsl:with-param name="FullName" select="SCHEMA_OBJ/NAME"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="$HasTableProperties=1 and $InColList=1">
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">0</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO