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

<?xml version="1.0"?>
<!-- Copyright (c) 2004, 2017, Oracle and/or its affiliates. 
All rights reserved.-->
<!-- 
NAME
    kuspar.xsl
DESCRIPTION
    This is a utility stylesheet for generating SXML syntax for
    partitioning.
    Used when converting mdapi TABLE_T document to TABLE document (SXML)

NOTE
    For (sub)partitioned tables,  there is a TRANSITION clause in 
    SQL'S CREATE TABLE that is specifically for Data Pump import.
    The TRANSITION clause identifies the last customer defined 
    partition so that when this DDL is executed as part of import,
    SQL will be able to properly mark which partitions are user
    defined and which are system generated when this table gets
    created.  The partitioning syntax on a CREATE TABLE looks like
    all specified partitions are 'user defined', but in import's
    case some of these are system generated and we need a way to 
    tell this to the target db.  Because import does not use SXML
    to generate the DDL of a table, we don't need to add TRANSITION
    support to the SXML (WAW).

MODIFIED        MM/DD/YY
    jjanosik    03/10/17 - Bug 24517168: Add storage to subpartitions
    bwright     03/02/16 - Defer AUTOMATIC LIST SUBPARTITIONING
    rapayne     12/15/15 - bug 22165030: fix imc SERVICE name after txn aditigu_sv2.
    rapayne     11/16/15 - bug 22165030: imc distribute for subpartition
                           templates.
    bwright     10/23/15 - Bug 22070917: Autolist in composite part. table
    jjanosik    10/08/15 - Don't add IML policy if it is inherited
    bwright     08/14/15 - Bug 20756134: STORE IN autolist part. table
    tbhukya     08/12/15 - Bug 21276592: Partitioned cluster
    rapayne     07/24/15 - Bug 19241274: support partition_by_quantity for 
                           app fusion.
    aditigu     03/03/15 - Bug 20433683: Unspecified IMC attrs should be null
    bwright     02/11/15 - Proj 49143: Add auto-list (sub)partitioning and
                           range interval subpartitioning w/ transition
    tbhukya     01/05/15 - Bug 20319428: Declare referred params
    rapayne     11/07/14 - bug 19976325 - deferred segment support for [P]IOTs.
    lbarton     10/15/14 - bug 18750140 issue 6: indexing off for subpartition
    rapayne     02/30/14 - bug 19134158: fix INMEMORY attributes for hash
                                        partitioned tables.
    rapayne     02/30/14 - bug 18155007: INMEMORY support.
    tbhukya     08/12/13 - Bug 17298672: Include varray clause for
                           partition storage clause
    lbarton     05/23/13 - bug 15872712: ILM policies
    rapayne     05/01/13 - bug 15924364: new advanced compression syntax
    sdavidso    04/15/13 - fix COMPRESS table property
   lbarton     03/14/12 - 36954_dpump_tabcluster_zonemap
    lbarton     03/14/12 - 36954_dpump_tabcluster_zonemap
    rapayne     10/24/11 - project 37634: partial index support.
    lbarton     09/20/11 - project 32935: row level locking
    rapayne     05/15/10 - bug-9702802: add NESTED_TABLE clause for partitions.
    lbarton     04/27/10 - bug 9650606: more dsc details
    lbarton     11/04/09 - deferred segment creation for partitions
    lbarton     07/10/09 - bug 8494344: archive compression
    rapayne     12/24/08 - bug 759589: add $STATISTICS support from CM code stream.
    lbarton     09/12/08 - bug 7362930: UNUSABLE index (sub)partitions
    lbarton     02/11/08 - reference/system partitioning
    lbarton     01/15/08 - Bug 6724820: table compression
    lbarton     11/13/06 - bug 5607195: subpartition template in interval
                           partition
    lbarton     10/09/06 - interval partitioning
    lbarton     08/28/06 - All composite partitioning combinations
    htseng      01/03/06 - add partitioning param 
    lbarton     11/09/05 - bug 4724986: fix handling of xmlns 
    sdavidso    11/02/05 - fix inconsistent stylesheet format 
    lbarton     09/15/05 - no STORE_AS in partition-level col properties 
    sdavidso    09/28/05 - NOCOMPRESS for partions in compressed index 
    lbarton     08/10/05 - lbarton_mddiff
    lbarton     11/05/04 - Initial version
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://xmlns.oracle.com/ku">
 <!-- Top level imports -->
 <xsl:import href="kuscomm.xsl"/>
 <xsl:import href="kusstorg.xsl"/>
 <xsl:import href="kusilm.xsl"/>
 <!-- Top level params -->
 <xsl:param name="STATISTICS">0</xsl:param>
 <xsl:param name="PARTITIONING">1</xsl:param>
 <xsl:param name="PARTITIONS_BY_QUANTITY">0</xsl:param>
 <xsl:param name="TABLESPACE">1</xsl:param>
 <!-- Templates -->
 <xsl:template name="TablePartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: TablePartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 TableNode: TABLE_T
******************************************************************** -->
  <!-- only generate INDEXING element if indexing is disabled 
       (i.e., NOT the default) 
  -->
  <xsl:if test="$VERSION>=1200000000 and ($PartobjNode/PARTOBJ/FLAGS mod 16384) >= 8192">
   <xsl:element name="INDEXING">OFF</xsl:element>
  </xsl:if>
  <!-- dispatch to the appropriate template -->
  <xsl:choose>
   <xsl:when test="($PropertyNode mod 128)>=64">
    <!-- PIOT -->
    <xsl:call-template name="PIOTPartitioning">
     <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
     <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
     <xsl:with-param name="ColListNode" select="$ColListNode"/>
     <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
     <xsl:with-param name="TableNode" select="$TableNode"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$PartobjNode/PARTOBJ/PARTTYPE=1">
    <!-- range -->
    <xsl:choose>
     <!-- RANGE (1), HASH (2) or LIST (4) subpartitions -->
     <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=1
                  or ($PartobjNode/PARTOBJ/SPARE2 mod 256)=2
                  or ($PartobjNode/PARTOBJ/SPARE2 mod 256)=4">
      <xsl:element name="RANGE_PARTITIONING">
       <xsl:call-template name="CompositePartitioning">
        <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
        <xsl:with-param name="PartitionType">RANGE</xsl:with-param>
        <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
        <xsl:with-param name="ColListNode" select="$ColListNode"/>
        <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
        <xsl:with-param name="TableNode" select="$TableNode"/>
       </xsl:call-template>
      </xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="RangePartitioning">
       <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
       <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
       <xsl:with-param name="ColListNode" select="$ColListNode"/>
       <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
       <xsl:with-param name="TableNode" select="$TableNode"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
   <xsl:when test="$PartobjNode/PARTOBJ/PARTTYPE=2">
    <!-- hash -->
    <xsl:choose>
     <!-- RANGE (1), HASH (2) or LIST (4) subpartitions -->
     <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=1
                  or ($PartobjNode/PARTOBJ/SPARE2 mod 256)=2
                  or ($PartobjNode/PARTOBJ/SPARE2 mod 256)=4">
      <xsl:element name="HASH_PARTITIONING">
       <xsl:call-template name="CompositePartitioning">
        <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
        <xsl:with-param name="PartitionType">HASH</xsl:with-param>
        <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
        <xsl:with-param name="ColListNode" select="$ColListNode"/>
        <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
        <xsl:with-param name="TableNode" select="$TableNode"/>
       </xsl:call-template>
      </xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="HashPartitioning">
       <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
       <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
       <xsl:with-param name="ColListNode" select="$ColListNode"/>
       <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
       <xsl:with-param name="TableNode" select="$TableNode"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
   <xsl:when test="$PartobjNode/PARTOBJ/PARTTYPE=3">
    <!-- system -->
    <xsl:call-template name="SystemPartitioning">
     <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
     <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
     <xsl:with-param name="ColListNode" select="$ColListNode"/>
     <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
     <xsl:with-param name="TableNode" select="$TableNode"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$PartobjNode/PARTOBJ/PARTTYPE=4">
    <!-- list -->
    <xsl:choose>
     <!-- RANGE (1), HASH (2) or LIST (4) subpartitions -->
     <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=1
                  or ($PartobjNode/PARTOBJ/SPARE2 mod 256)=2
                  or ($PartobjNode/PARTOBJ/SPARE2 mod 256)=4">
      <xsl:element name="LIST_PARTITIONING">
       <xsl:call-template name="CompositePartitioning">
        <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
        <xsl:with-param name="PartitionType">LIST</xsl:with-param>
        <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
        <xsl:with-param name="ColListNode" select="$ColListNode"/>
        <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
        <xsl:with-param name="TableNode" select="$TableNode"/>
       </xsl:call-template>
      </xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="ListPartitioning">
       <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
       <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
       <xsl:with-param name="ColListNode" select="$ColListNode"/>
       <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
       <xsl:with-param name="TableNode" select="$TableNode"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
   <xsl:when test="$PartobjNode/PARTOBJ/PARTTYPE=5">
    <!-- reference  -->
    <xsl:call-template name="ReferencePartitioning">
     <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
     <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
     <xsl:with-param name="ColListNode" select="$ColListNode"/>
     <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
     <xsl:with-param name="TableNode" select="$TableNode"/>
    </xsl:call-template>
   </xsl:when>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="PIOTPartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: PIOTPartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:choose>
   <xsl:when test="$PartobjNode/TABPARTOBJ/PARTTYPE=1">
    <!-- range -->
    <xsl:call-template name="RangePartitioning">
     <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
     <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
     <xsl:with-param name="ColListNode" select="$ColListNode"/>
     <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
     <xsl:with-param name="PartCompress" select="$PartobjNode/../NUMKEYCOLS > 0"/>
     <xsl:with-param name="TableNode" select="$TableNode"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$PartobjNode/TABPARTOBJ/PARTTYPE=2">
    <!-- hash -->
    <xsl:call-template name="HashPartitioning">
     <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
     <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
     <xsl:with-param name="ColListNode" select="$ColListNode"/>
     <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
     <xsl:with-param name="TableNode" select="$TableNode"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$PartobjNode/TABPARTOBJ/PARTTYPE=4">
    <!-- list -->
    <xsl:call-template name="ListPartitioning">
     <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
     <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
     <xsl:with-param name="ColListNode" select="$ColListNode"/>
     <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
     <xsl:with-param name="TableNode" select="$TableNode"/>
    </xsl:call-template>
   </xsl:when>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="RangePartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="PartCompress" select="false()"/>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: RangePartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 PartCompress - TRUE = key COMPRESS specified at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:element name="RANGE_PARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$PartobjNode/PARTCOLS"/>
   </xsl:call-template>
   <!-- Don't generate default physical properties for partitioned 
        cluster table -->
   <xsl:if test="not(($TableNode/PROPERTY mod 2048)>=1024)">
    <xsl:call-template name="DefaultPhysicalProperties">
     <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
     <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
     <xsl:with-param name="TableNode" select="$TableNode"/>
    </xsl:call-template>
   </xsl:if>
   <xsl:apply-templates select="$PartobjNode/PARTOBJ/INTERVAL_STR"/>
   <xsl:apply-templates select="$PartobjNode/PARTOBJ/INSERT_TS_LIST"/>
   <xsl:call-template name="PartitionList">
    <xsl:with-param name="PartListNode" select="$PartobjNode/PART_LIST"/>
    <xsl:with-param name="PartitionType">RANGE</xsl:with-param>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="PartCompress" select="$PartCompress"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template match="INTERVAL_STR | SUBINTERVAL_STR">
  <!-- *******************************************************************
Template: INTERVAL_STR
******************************************************************** -->
  <xsl:element name="INTERVAL">
   <xsl:value-of select="."/>
  </xsl:element>
 </xsl:template>
 <xsl:template match="INSERT_TS_LIST">
  <!-- *******************************************************************
Template: INSERT_TS_LIST
******************************************************************** -->
  <xsl:if test="INSERT_TS_LIST_ITEM">
   <xsl:element name="STORE_IN">
    <xsl:for-each select="INSERT_TS_LIST_ITEM">
     <xsl:element name="STORE_IN_ITEM">
      <xsl:value-of select="NAME"/>
     </xsl:element>
    </xsl:for-each>
   </xsl:element>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoPartColList">
  <xsl:param name="PartcolsNode" select="''"/>
  <!-- *******************************************************************
Template: DoPartColList
Parameters:
 PartcolsNode - PARTCOLS or SUBPARTCOLS node
******************************************************************** -->
  <xsl:element name="COL_LIST">
   <xsl:for-each select="$PartcolsNode/PARTCOLS_ITEM |
                        $PartcolsNode/SUBPARTCOLS_ITEM">
    <xsl:element name="COL_LIST_ITEM">
     <xsl:call-template name="ColName">
      <xsl:with-param name="ColNode" select="COL"/>
     </xsl:call-template>
    </xsl:element>
   </xsl:for-each>
  </xsl:element>
 </xsl:template>
 <xsl:template name="DefaultPhysicalProperties">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <xsl:param name="PartNode" select="''"/>
  <!-- *******************************************************************
Template: DefaultPhysicalProperties
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 TabBlocksize - BLOCKSIZE at the TABLE level
 TableNode: TABLE_T
 PartNode: partition or subpartition node (PART_LIST_ITEM or SUBPARTS_ITEM)
******************************************************************** -->
  <xsl:if test="not ($PHYSICAL_PROPERTIES=0)">
   <xsl:element name="DEFAULT_PHYSICAL_PROPERTIES">
    <!--inmemory columnar - do only if we are actually process a table or mview-->
    <xsl:if test="local-name(.)='TABLE_T' or local-name(.)='MVIEW_TAB'">
     <!-- inmemory columnar - definitions from dcore.bsq
 the bits in spare2 line up with KKPACOCD_IMC_xxxx symbols in kkpac.h:
  stored in partobj$.spare2, byte 5/6   : inmemory columnar attributes            
  /* byte 5   : inmemory columnar attributes            */
  /*            00000000 : imc not specified            */ 
  /*            00000001 : imc explicitly enabled       */ 1
  /*            00000010 : imc explicitly not enabled   */ 2
  /*            00000100 : imc_mirrormap */                4
  /*            00001000 : imc level 1 */                  8
  /*            00010000 : imc_preload  */                16
  /*            00100000 : imc_mapby1  */                 32
  /*            01000000 : imc_mapby2  */
  /*            10000000 : imc level        */           128
  /* byte 6:    00000001 : imc level 3    */            
  /*            00000010 : imc level 4*/
  /*            00000100 : duplicate1  */               1024
  /*            00001000 : duplicate2  */
  /*            IMC preload priority levels */
  /*            00010000 : priority NONE */             4096
  /*            00100000 : priority LOW */
  /*            01000000 : priority MEDIUM */
  /*            10000000 : priority HIGH */
  /* byte 7:    00000001 : priority CRITICAL */-->
     <xsl:variable name="IMCsegflag">
      <xsl:choose>
       <xsl:when test="$PartobjNode/PARTOBJ/IMC_FLAGS">
        <xsl:value-of select="$PartobjNode/PARTOBJ/IMC_FLAGS"/>
       </xsl:when>
       <xsl:otherwise>
        <xsl:value-of select="floor($PartobjNode/PARTOBJ/SPARE2 div 1099511627776)"/>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="Enabled" select="($IMCsegflag) mod 2"/>
     <xsl:variable name="Disabled" select="floor($IMCsegflag div 2) mod 2"/>
     <xsl:variable name="MirrorMap" select="floor($IMCsegflag div 4) mod 2"/>
     <xsl:variable name="Level1" select="floor($IMCsegflag div 8) mod 2"/>
     <xsl:variable name="Preload" select="floor($IMCsegflag div 16) mod 2"/>
     <xsl:variable name="MapBy12" select="floor($IMCsegflag div 32) mod 4"/>
     <xsl:variable name="Level234" select="floor($IMCsegflag div 128) mod 8"/>
     <xsl:variable name="Priority" select="floor($IMCsegflag div 4096) mod 8"/>
     <xsl:call-template name="xDoInMemory">
      <xsl:with-param name="InMemory">
       <xsl:choose>
        <xsl:when test="$Enabled = 1">
         <xsl:text>1</xsl:text>
        </xsl:when>
        <xsl:when test="$Disabled = 1">
         <xsl:text>2</xsl:text>
        </xsl:when>
        <xsl:otherwise>
         <xsl:text>0</xsl:text>
        </xsl:otherwise>
       </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="Priority">
       <xsl:choose>
        <xsl:when test="$Preload=1">
         <xsl:choose>
          <xsl:when test="$Priority=0">
           <xsl:text>0</xsl:text>
          </xsl:when>
          <xsl:when test="$Priority=1">
           <xsl:text>1</xsl:text>
          </xsl:when>
          <xsl:when test="$Priority=2">
           <xsl:text>2</xsl:text>
          </xsl:when>
          <xsl:when test="$Priority=3">
           <xsl:text>4</xsl:text>
          </xsl:when>
          <xsl:when test="$Priority=4">
           <xsl:text>6</xsl:text>
          </xsl:when>
          <xsl:otherwise>
           <xsl:text>5</xsl:text>
          </xsl:otherwise>
         </xsl:choose>
        </xsl:when>
        <xsl:when test="$Preload=0">
         <xsl:choose>
          <xsl:when test="$Priority=5">
           <xsl:text>7</xsl:text>
          </xsl:when>
          <xsl:otherwise>
           <xsl:text>0</xsl:text>
          </xsl:otherwise>
         </xsl:choose>
        </xsl:when>
       </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="Compression" select="($Level234*2)+$Level1"/>
      <xsl:with-param name="Distribute" select="($MapBy12*2)+$MirrorMap"/>
      <xsl:with-param name="Duplicate" select="floor($IMCsegflag div 1024) mod 4"/>
     </xsl:call-template>
    </xsl:if>
    <xsl:choose>
     <xsl:when test="($PropertyNode mod 128)>=64">
      <!-- IOT -->
      <xsl:element name="INDEX_ORGANIZED_TABLE">
       <xsl:call-template name="SegmentAttributes">
        <xsl:with-param name="ParentNode" select="$PartobjNode/INDPARTOBJ"/>
        <xsl:with-param name="Partitioned">1</xsl:with-param>
        <xsl:with-param name="ObjType">INDEX</xsl:with-param>
        <xsl:with-param name="DefaultBlocksize" select="$TabBlocksize"/>
        <xsl:with-param name="TableNode" select="$TableNode"/>
        <xsl:with-param name="PartNode" select="$PartobjNode"/>
       </xsl:call-template>
       <xsl:if test="(FLAGS mod 536870912) >= 268435456">
        <xsl:element name="MAPPING_TABLE"/>
       </xsl:if>
       <xsl:element name="PCTTHRESHOLD">
        <xsl:value-of select="PCT_THRESH"/>
       </xsl:element>
       <xsl:if test="NUMKEYCOLS>0">
        <xsl:element name="KEYCOMPRESS">
         <xsl:value-of select="NUMKEYCOLS"/>
        </xsl:element>
       </xsl:if>
       <xsl:if test="(PROPERTY mod 256)>=128">
        <!-- IOV -->
        <xsl:call-template name="DoIOV">
         <xsl:with-param name="IOVNode" select="$PartobjNode/OVPARTOBJ"/>
         <xsl:with-param name="InclcolName" select="INCLCOL_NAME"/>
         <xsl:with-param name="Partitioned">1</xsl:with-param>
        </xsl:call-template>
       </xsl:if>
      </xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <!-- heap table -->
      <xsl:element name="HEAP_TABLE">
       <xsl:call-template name="SegmentAttributes">
        <xsl:with-param name="ParentNode" select="$PartobjNode/PARTOBJ"/>
        <xsl:with-param name="Partitioned">1</xsl:with-param>
        <xsl:with-param name="ObjType">TABLE</xsl:with-param>
        <xsl:with-param name="DefaultBlocksize" select="$TabBlocksize"/>
        <xsl:with-param name="TableNode" select="$TableNode"/>
        <xsl:with-param name="PartNode" select="$PartNode"/>
       </xsl:call-template>
       <!-- check byte 4 of SPARE2 for table compression -->
       <xsl:call-template name="DoPartOBJCompress">
        <xsl:with-param name="Compress" select="(floor($PartobjNode/PARTOBJ/SPARE2 div 4294967296)) mod 256"/>
       </xsl:call-template>
       <!-- Add ILM Policy to table storage -->
       <xsl:apply-templates select="ILM_POLICIES"/>
      </xsl:element>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:element>
  </xsl:if>
 </xsl:template>
 <xsl:template name="PartitionList">
  <xsl:param name="PartListNode" select="''"/>
  <xsl:param name="PartitionType" select="''"/>
  <xsl:param name="SubpartitionType" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="PartCompress" select="false()"/>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: PartitionList
Parameters:
 PartListNode     - PART_LIST node or COMPART_LIST_NODE
 PartitionType    - RANGE, HASH, LIST, REFERENCE or ''
 SubpartitionType - RANGE, HASH, LIST or ''
 PropertyNode     - PROPERTY node
 ColListNode      - COL_LIST node
 TabBlocksize     - BLOCKSIZE at table level
 PartCompress - TRUE = key COMPRESS specified at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:if test="$PARTITIONING=1">
   <xsl:element name="PARTITION_LIST">
    <!-- skip partitions in interval section -->
    <xsl:for-each select="$PartListNode/PART_LIST_ITEM[32768>(FLAGS mod 65536)] |
                         $PartListNode/COMPART_LIST_ITEM[32768>(FLAGS mod 65536)]">
     <xsl:element name="PARTITION_LIST_ITEM">
      <xsl:element name="NAME">
       <xsl:value-of select="SCHEMA_OBJ/SUBNAME"/>
      </xsl:element>
      <!-- Only generate INDEXING element if indexing has been disabled or if 
           the default table level indexing has been disabled.
           note: indexing flags for COMPOSITE partitioned table are in SPARE2
                 otherwise they are in FLAGS. See dpart.bsq/tabcompart$ for 
                 SPARE2 bit descriptions.
      -->
      <xsl:if test="$VERSION>=1200000000">
       <xsl:choose>
        <xsl:when test="(local-name(.)) = 'COMPART_LIST_ITEM' and
                              ( (SPARE2 mod (2048*2)) >= 2048)">
         <!-- composite partitions use SPARE2 -->
         <xsl:element name="INDEXING">OFF</xsl:element>
        </xsl:when>
        <xsl:when test="(FLAGS mod 4194304) >= 2097152">
         <xsl:element name="INDEXING">OFF</xsl:element>
        </xsl:when>
        <xsl:otherwise>
         <!-- If the default table level indexing has been disabled then we need to be
              explicit! 
              note: when we are transforming MVIEW objects TableNode will be empty 
          -->
         <xsl:if test="$TableNode and (($TableNode/PART_OBJ/PARTOBJ/FLAGS mod 16384) >= 8192)">
          <xsl:element name="INDEXING">ON</xsl:element>
         </xsl:if>
        </xsl:otherwise>
       </xsl:choose>
      </xsl:if>
      <xsl:choose>
       <xsl:when test="$PartitionType='HASH'">
        <xsl:call-template name="PartitioningStorageClause">
         <xsl:with-param name="TableNode" select="$TableNode"/>
         <xsl:with-param name="PartListItemNode" select="."/>
        </xsl:call-template>
        <!-- column properties:
              LOB storage clause,
              varray col properties (when stored as lob)
        -->
        <xsl:if test="LOBS/LOBS_ITEM">
         <xsl:call-template name="PartLobStorage">
          <xsl:with-param name="PartListItemNode" select="."/>
          <xsl:with-param name="PartitionType" select="$PartitionType"/>
          <xsl:with-param name="ColListNode" select="$ColListNode"/>
          <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
          <xsl:with-param name="PartitioningStorage">1</xsl:with-param>
         </xsl:call-template>
        </xsl:if>
        <!-- COMPRESS -->
        <xsl:choose>
         <xsl:when test="./DEFERRED_STG">
          <xsl:call-template name="DoDeferredStgSegCompress">
           <xsl:with-param name="DeferredStg" select="./DEFERRED_STG"/>
          </xsl:call-template>
         </xsl:when>
         <xsl:when test="./SPARE2">
          <xsl:call-template name="DoPartOBJCompress">
           <xsl:with-param name="Compress" select="(./SPARE2 mod 256)"/>
          </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
          <xsl:call-template name="DoSegCompress">
           <xsl:with-param name="Compress" select="./STORAGE/FLAGS"/>
          </xsl:call-template>
         </xsl:otherwise>
        </xsl:choose>
        <xsl:call-template name="xDoSegInMemory">
         <xsl:with-param name="Deferred">
          <xsl:choose>
           <xsl:when test="(FLAGS mod 131072)>=65536">
            <!-- if deferred segment creation, storage params are in DEFERRED_STG$ -->
            <xsl:text>1</xsl:text>
           </xsl:when>
           <xsl:otherwise>
            <xsl:text>0</xsl:text>
           </xsl:otherwise>
          </xsl:choose>
         </xsl:with-param>
         <xsl:with-param name="ParentNode" select="."/>
        </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
        <xsl:if test="$PartitionType!='REFERENCE' and $PartitionType!='SYSTEM'">
         <!-- RANGE and LIST partitions -->
         <xsl:element name="VALUES">
          <xsl:value-of select="HIBOUNDVAL"/>
         </xsl:element>
        </xsl:if>
        <xsl:call-template name="TablePartitionDescription">
         <xsl:with-param name="PartListItemNode" select="."/>
         <xsl:with-param name="PartitionType" select="$PartitionType"/>
         <xsl:with-param name="SubpartitionType" select="$SubpartitionType"/>
         <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
         <xsl:with-param name="ColListNode" select="$ColListNode"/>
         <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
         <xsl:with-param name="PartCompress" select="$PartCompress"/>
         <xsl:with-param name="TableNode" select="$TableNode"/>
        </xsl:call-template>
       </xsl:otherwise>
      </xsl:choose>
      <xsl:if test="(string(ROWCNT) and not ($STATISTICS=0))">
       <xsl:element name="STATISTICS">
        <xsl:call-template name="CreTablePartStats">
         <xsl:with-param name="PartListItemNode" select="."/>
        </xsl:call-template>
       </xsl:element>
      </xsl:if>
     </xsl:element>
    </xsl:for-each>
   </xsl:element>
  </xsl:if>
 </xsl:template>
 <xsl:template name="CreTablePartStats">
  <xsl:param name="PartListItemNode" select="''"/>
  <!-- *******************************************************************
  Template: CrePartStats - processing partition stats
  Current node: PART_OBJ PART_LIST_ITEM PART_LIST

  Emit the following:
 ROWCNT
 BLKCNT
 EMPCNT
 AVGSPC
 CHNCNT
 AVGRLN
 ANALYZETIME
 SAMPLESIZE

******************************************************************** -->
  <xsl:element name="ROWCNT">
   <xsl:value-of select="$PartListItemNode/ROWCNT"/>
  </xsl:element>
  <xsl:element name="BLKCNT">
   <xsl:value-of select="$PartListItemNode/BLKCNT"/>
  </xsl:element>
  <xsl:element name="EMPCNT">
   <xsl:value-of select="$PartListItemNode/EMPCNT"/>
  </xsl:element>
  <xsl:element name="AVGSPC">
   <xsl:value-of select="$PartListItemNode/AVGSPC"/>
  </xsl:element>
  <xsl:element name="CHNCNT">
   <xsl:value-of select="$PartListItemNode/CHNCNT"/>
  </xsl:element>
  <xsl:element name="AVGRLN">
   <xsl:value-of select="$PartListItemNode/AVGRLN"/>
  </xsl:element>
  <xsl:element name="ANALYZETIME">
   <xsl:value-of select="$PartListItemNode/ANALYZETIME"/>
  </xsl:element>
  <xsl:element name="SAMPLESIZE">
   <xsl:value-of select="$PartListItemNode/SAMPLESIZE"/>
  </xsl:element>
 </xsl:template>
 <xsl:template name="CreIndexPartStats">
  <xsl:param name="PartListItemNode" select="''"/>
  <!-- *******************************************************************
Template: CreIndexPartStats - processing index partitioning stats
Current node: //PARTITION_LIST_ITEM
  Emit the following:
ROWCNT
 BLKCNT
 EMPCNT
 AVGSPC
 CHNCNT
 AVGRLN
 AVGSPC_FLB
 FLBCNT
 ANALYZETIME
 SAMPLESIZE
 BLEVEL
 LEAFCNT
 DISTKEY
 LBLKKEY
 DBLKKEY
******************************************************************** -->
  <xsl:element name="ROWCNT">
   <xsl:value-of select="$PartListItemNode/ROWCNT"/>
  </xsl:element>
  <xsl:element name="BLEVEL">
   <xsl:value-of select="$PartListItemNode/BLEVEL"/>
  </xsl:element>
  <xsl:element name="LEAFCNT">
   <xsl:value-of select="$PartListItemNode/LEAFCNT"/>
  </xsl:element>
  <xsl:element name="DISTKEY">
   <xsl:value-of select="$PartListItemNode/DISTKEY"/>
  </xsl:element>
  <xsl:element name="LBLKKEY">
   <xsl:value-of select="$PartListItemNode/LBLKKEY"/>
  </xsl:element>
  <xsl:element name="DBLKKEY">
   <xsl:value-of select="$PartListItemNode/DBLKKEY"/>
  </xsl:element>
  <xsl:element name="CLUFAC">
   <xsl:value-of select="$PartListItemNode/CLUFAC"/>
  </xsl:element>
 </xsl:template>
 <xsl:template name="IndexPartitionList">
  <xsl:param name="PartListNode" select="''"/>
  <xsl:param name="PartitionType" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="Local">0</xsl:param>
  <xsl:param name="PartCompress" select="false()"/>
  <!-- *******************************************************************
Template: IndexPartitionList - PARTITION_LIST for indexes
Parameters:
 PartListNode  - PART_LIST node or COMPART_LIST node
 PartitionType - RANGE, HASH or ''
 TabBlocksize  - BLOCKSIZE at table level
 Local         - 1 = LOCAL partitioning
 PartCompress  - TRUE = key COMPRESS specified at index level
******************************************************************** -->
  <xsl:if test="$PARTITIONING=1">
   <xsl:choose>
    <xsl:when test="$PartitionType='HASH' and $PARTITIONS_BY_QUANTITY=1">
     <xsl:element name="PARTITIONS_BY_QUANTITY">
      <xsl:element name="QUANTITY">
       <xsl:value-of select="count($PartListNode/PART_LIST_ITEM)"/>
      </xsl:element>
      <xsl:if test="$TABLESPACE=1 and $PartListNode/PART_LIST_ITEM[*]/TS_NAME">
       <xsl:element name="TABLESPACE_LIST">
        <xsl:for-each select="$PartListNode/PART_LIST_ITEM/TS_NAME[not(.=preceding::*)]">
         <xsl:element name="TABLESPACE">
          <xsl:value-of select="."/>
         </xsl:element>
        </xsl:for-each>
       </xsl:element>
      </xsl:if>
     </xsl:element>
    </xsl:when>
    <xsl:otherwise>
     <xsl:element name="PARTITION_LIST">
      <xsl:for-each select="$PartListNode/PART_LIST_ITEM |
                         $PartListNode/COMPART_LIST_ITEM">
       <xsl:element name="PARTITION_LIST_ITEM">
        <xsl:element name="NAME">
         <xsl:value-of select="SCHEMA_OBJ/SUBNAME"/>
        </xsl:element>
        <xsl:choose>
         <xsl:when test="$PartitionType='HASH'">
          <xsl:call-template name="Tablespace">
           <xsl:with-param name="ParentNode" select="."/>
          </xsl:call-template>
         </xsl:when>
         <!-- RANGE partitions -->
         <xsl:otherwise>
          <xsl:if test="$Local=0">
           <xsl:element name="VALUES">
            <xsl:value-of select="HIBOUNDVAL"/>
           </xsl:element>
          </xsl:if>
          <xsl:call-template name="SegmentAttributes">
           <xsl:with-param name="ParentNode" select="."/>
           <xsl:with-param name="Partitioned">
            <xsl:choose>
             <xsl:when test="local-name($PartListNode)='PART_LIST'">0</xsl:when>
             <xsl:otherwise>1</xsl:otherwise>
            </xsl:choose>
           </xsl:with-param>
           <xsl:with-param name="ObjType">INDEX</xsl:with-param>
           <xsl:with-param name="PartitionType" select="$PartitionType"/>
          </xsl:call-template>
          <!-- in a partitioned index with key compression    BUG 4544267 -->
          <!--   some partitions can be NOCOMPRESS              -->
          <xsl:if test="$PartCompress
                     and ((FLAGS mod 2048) &lt; 1024)">
           <xsl:element name="KEYCOMPRESS">N</xsl:element>
          </xsl:if>
         </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="(FLAGS mod 2)>=1">
         <xsl:element name="UNUSABLE"/>
        </xsl:if>
        <!-- partition-level subpartition -->
        <xsl:if test="SUBPARTS">
         <xsl:call-template name="SubpartitionList">
          <xsl:with-param name="PartListNode" select="SUBPARTS"/>
         </xsl:call-template>
        </xsl:if>
        <xsl:if test="(string(ROWCNT) and not ($STATISTICS=0))">
         <xsl:element name="STATISTICS">
          <xsl:call-template name="CreIndexPartStats">
           <xsl:with-param name="PartListItemNode" select="."/>
          </xsl:call-template>
         </xsl:element>
        </xsl:if>
       </xsl:element>
      </xsl:for-each>
     </xsl:element>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>
 <xsl:template name="TablePartitionDescription">
  <xsl:param name="PartListItemNode" select="''"/>
  <xsl:param name="PartitionType" select="''"/>
  <xsl:param name="SubpartitionType" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="PartCompress" select="false()"/>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: TablePartitionDescription
Parameters:
 PartListItemNode  - PART_LIST_ITEM node or COMPART_LIST_ITEM node
 PartitionType - RANGE, LIST
 SubpartitionType - HASH, LIST or ''
 PropertyNode  - PROPERTY node
 ColListNode   - COL_LIST node
 TabBlocksize  - BLOCKSIZE at table level
 PartCompress  - TRUE = key COMPRESS specified at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:if test="not ($PHYSICAL_PROPERTIES=0)">
   <xsl:element name="PHYSICAL_PROPERTIES">
    <xsl:choose>
     <xsl:when test="($PropertyNode mod 128)>=64">
      <!-- IOT -->
      <xsl:element name="INDEX_ORGANIZED_TABLE">
       <xsl:call-template name="SegmentAttributes">
        <xsl:with-param name="ParentNode" select="$PartListItemNode"/>
        <xsl:with-param name="Partitioned">
         <xsl:choose>
          <xsl:when test="local-name($PartListItemNode)='PART_LIST_ITEM'">0</xsl:when>
          <xsl:otherwise>1</xsl:otherwise>
         </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="ObjType">
         <xsl:choose>
          <xsl:when test="($PropertyNode mod 128)>=64">PIOT_PARTITION</xsl:when>
          <xsl:otherwise>PARTITION</xsl:otherwise>
         </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="PartitionType" select="$PartitionType"/>
        <xsl:with-param name="TableNode" select="$TableNode"/>
        <xsl:with-param name="PartNode" select="$PartListItemNode"/>
       </xsl:call-template>
       <!-- in a compressed partitioned table    BUG 4544267 -->
       <!--   some partitions can be NOCOMPRESS              -->
       <xsl:if test="$PartCompress
                   and (($PartListItemNode/FLAGS mod 2048) &lt; 1024)">
        <xsl:element name="KEYCOMPRESS">N</xsl:element>
       </xsl:if>
       <!-- index org overflow clause -->
       <xsl:if test="($PropertyNode mod 256)>=128">
        <xsl:call-template name="DoIOV">
         <xsl:with-param name="IOVNode" select="$PartListItemNode/../../IOV_LIST/IOV_LIST_ITEM[PART_NUM=current()/PART_NUM]"/>
         <xsl:with-param name="Partitioned">0</xsl:with-param>
        </xsl:call-template>
       </xsl:if>
      </xsl:element>
      <!-- INDEX_ORGANIZED_TABLE -->
     </xsl:when>
     <xsl:otherwise>
      <!-- heap table -->
      <xsl:element name="HEAP_TABLE">
       <xsl:call-template name="SegmentAttributes">
        <xsl:with-param name="ParentNode" select="$PartListItemNode"/>
        <xsl:with-param name="Partitioned">
         <xsl:choose>
          <xsl:when test="local-name($PartListItemNode)='PART_LIST_ITEM'">0</xsl:when>
          <xsl:otherwise>1</xsl:otherwise>
         </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="ObjType">
         <xsl:choose>
          <xsl:when test="($PropertyNode mod 128)>=64">PIOT_PARTITION</xsl:when>
          <xsl:otherwise>PARTITION</xsl:otherwise>
         </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="PartitionType" select="$PartitionType"/>
        <xsl:with-param name="TableNode" select="$TableNode"/>
        <xsl:with-param name="PartNode" select="$PartListItemNode"/>
       </xsl:call-template>
       <!-- COMPRESS -->
       <!-- Donot generate compress clause for partitioned cluster -->
       <xsl:if test="$TableNode/SCHEMA_OBJ/TYPE_NAME!='CLUSTER'">
        <xsl:choose>
         <xsl:when test="$PartListItemNode/DEFERRED_STG">
          <xsl:call-template name="DoDeferredStgSegCompress">
           <xsl:with-param name="DeferredStg" select="$PartListItemNode/DEFERRED_STG"/>
          </xsl:call-template>
         </xsl:when>
         <xsl:when test="$PartListItemNode/SPARE2">
          <xsl:call-template name="DoPartOBJCompress">
           <xsl:with-param name="Compress" select="($PartListItemNode/SPARE2 mod 256)"/>
          </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
          <xsl:call-template name="DoSegCompress">
           <xsl:with-param name="Compress" select="$PartListItemNode/STORAGE/FLAGS"/>
          </xsl:call-template>
         </xsl:otherwise>
        </xsl:choose>
       </xsl:if>
       <xsl:apply-templates select="ILM_POLICIES"/>
      </xsl:element>
      <!-- HEAP_TABLE -->
     </xsl:otherwise>
    </xsl:choose>
    <!-- inmemory columnar - compress, load, map/mirror
 INMEMORY is not supported for indexes or IOTs-->
    <xsl:if test="($TableNode/PROPERTY mod 128) &lt; 64 and not (
(local-name(.)='SUBPARTS_ITEM' and (ancestor::PART_OBJ/PARTOBJ/SPARE2 mod 256)=2) or 
(local-name(.)='PART_LIST_ITEM' and (ancestor::PART_OBJ/PARTOBJ/PARTTYPE=2)))">
     <xsl:choose>
      <xsl:when test="local-name(.)='COMPART_LIST_ITEM'">
       <!-- if this is a composite partition, tabcompart$.spare2
          has default InMemory for subpartitions
    verified 4/14/2014 against usage in admin/cdpart.sql
    compression and duplicate1/2 overlap.

v        IMC_ENABLED    (ub4) 0x10000          /* IMC specified */ 65536
         IMC_NOTENABLED (ub4) 0x20000      /* IMC specified not */ 131072
v        IMC_MIRRORMAP  (ub4) 0x40000      /* IMC mirror or map */ 262144
v        IMC_LEVEL1     (ub4) 0x80000       /* IMC low or other */ 524288
v        IMC_PRELOAD    (ub4)0x100000/* IMC ondemand or preload */ 1048576
v        IMC_MAPBY1     (ub4)0x200000      /* IMC rowid or part */ 2097152
v        IMC_MAPBY2     (ub4)0x400000    /* IMC part or subpart */ 4194304
v        IMC_LEVEL2     (ub4)0x800000        /* IMC low or high */ 8388608
v        IMC_LEVEL3     (ub4)0x1000000        /* IMC qry or cap */ 16777216
v        IMC_DUPLICATE1 (ub4)0x4000000          /* IMC copies 1 */ 67108864
v        IMC_DUPLICATE2 (ub4)0x8000000          /* IMC copies 1 */ 134217728

        By observation:    0x01C000000 mask value 
v        IMC_PRI_NONE      0x000000000
v        IMC_PRI_LOW       0x010000000 268435456
v        IMC_PRI_MEDIUM    0x020000000
v        IMC_PRI_HIGH      0x030000000
v        IMC_PRI_CRITICAL  0x040000000
     -->
       <xsl:variable name="Enabled" select="floor(SPARE2 div 65536) mod 2"/>
       <xsl:variable name="Disabled" select="floor(SPARE2 div 131072) mod 2"/>
       <xsl:variable name="MirrorMap" select="floor(SPARE2 div 262144) mod 2"/>
       <xsl:variable name="Level1" select="floor(SPARE2 div 524288) mod 2"/>
       <xsl:variable name="Preload" select="floor(SPARE2 div 1048576) mod 2"/>
       <xsl:variable name="MapBy12" select="floor(SPARE2 div 2097152) mod 4"/>
       <xsl:variable name="Level234" select="floor(SPARE2 div 8388608) mod 8"/>
       <!-- storage is allocated, params are in SEG$ - aka the STORAGE element. -->
       <xsl:variable name="Priority" select="floor(SPARE2 div 268435456) mod 8"/>
       <xsl:call-template name="xDoInMemory">
        <xsl:with-param name="InMemory">
         <xsl:choose>
          <xsl:when test="$Enabled = 1">
           <xsl:text>1</xsl:text>
          </xsl:when>
          <xsl:when test="$Disabled = 1">
           <xsl:text>2</xsl:text>
          </xsl:when>
          <xsl:otherwise>
           <xsl:text>0</xsl:text>
          </xsl:otherwise>
         </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="Priority">
         <xsl:choose>
          <xsl:when test="$Preload=1">
           <xsl:choose>
            <xsl:when test="$Priority=0">
             <xsl:text>0</xsl:text>
            </xsl:when>
            <xsl:when test="$Priority=1">
             <xsl:text>1</xsl:text>
            </xsl:when>
            <xsl:when test="$Priority=2">
             <xsl:text>2</xsl:text>
            </xsl:when>
            <xsl:when test="$Priority=3">
             <xsl:text>4</xsl:text>
            </xsl:when>
            <xsl:when test="$Priority=4">
             <xsl:text>6</xsl:text>
            </xsl:when>
            <xsl:otherwise>
             <xsl:text>5</xsl:text>
            </xsl:otherwise>
           </xsl:choose>
          </xsl:when>
          <xsl:when test="$Preload=0">
           <xsl:choose>
            <xsl:when test="$Priority=5">
             <xsl:text>7</xsl:text>
            </xsl:when>
            <xsl:otherwise>
             <xsl:text>0</xsl:text>
            </xsl:otherwise>
           </xsl:choose>
          </xsl:when>
         </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="Compression" select="($Level234*2)+$Level1"/>
        <xsl:with-param name="Distribute" select="($MapBy12*2)+$MirrorMap"/>
        <xsl:with-param name="Duplicate" select="floor(SPARE2 div 67108864) mod 4"/>
        <xsl:with-param name="ServiceName">
         <xsl:if test="SVCFLAGS">
          <xsl:choose>
           <xsl:when test="SVCFLAGS=1">
            <xsl:text>DEFAULT</xsl:text>
           </xsl:when>
           <xsl:when test="SVCFLAGS=2">
            <xsl:text>NONE</xsl:text>
           </xsl:when>
           <xsl:when test="SVCFLAGS=3">
            <xsl:text>ALL</xsl:text>
           </xsl:when>
           <xsl:when test="SVCFLAGS=4">
            <xsl:value-of select="SVCNAME"/>
           </xsl:when>
           <xsl:otherwise>DEFAULT</xsl:otherwise>
          </xsl:choose>
         </xsl:if>
        </xsl:with-param>
       </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
       <!--.from DEFERRED_STG/IMCFLAG_STG or STORAGE/FLAGS -->
       <xsl:call-template name="xDoSegInMemory">
        <xsl:with-param name="Deferred">
         <xsl:choose>
          <xsl:when test="(FLAGS mod 131072)>=65536">
           <!-- if deferred segment creation, storage params are in DEFERRED_STG$ -->
           <xsl:text>1</xsl:text>
          </xsl:when>
          <xsl:otherwise>
           <xsl:text>0</xsl:text>
          </xsl:otherwise>
         </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="ParentNode" select="."/>
       </xsl:call-template>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:if>
   </xsl:element>
  </xsl:if>
  <!-- PHYSICAL_PROPERTIES -->
  <!-- column properties:
         LOB storage clause,
         varray col properties (when stored as lob)
   -->
  <xsl:if test="$PartListItemNode/LOBS/LOBS_ITEM or
                       $PartListItemNode/NT/NTS/NTS_ITEM">
   <!-- blob (type 113)
        clob (type 112) that is not system-generated
         (the idea is to exclude lob storage for xmltype columns
          since LOB STORE AS is not allowed at the partition level)
        varray (type 123) with collection storage
   -->
   <xsl:call-template name="PartLobStorage">
    <xsl:with-param name="PartListItemNode" select="$PartListItemNode"/>
    <xsl:with-param name="PartitionType" select="$PartitionType"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
   </xsl:call-template>
  </xsl:if>
  <!-- partition-level subpartition 
       bug 5607195: skip subpartitions if they default from template
  -->
  <xsl:if test="$PartListItemNode/SUBPARTS and not ($PartListItemNode/SMATCH_TPL and $PartListItemNode/SMATCH_TPL=1)">
   <xsl:call-template name="SubpartitionList">
    <xsl:with-param name="PartListNode" select="$PartListItemNode/SUBPARTS"/>
    <xsl:with-param name="SubpartitionType" select="$SubpartitionType"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="SubpartitionList">
  <xsl:param name="PartListNode" select="''"/>
  <xsl:param name="SubpartitionType" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <!-- *******************************************************************
Template: SubpartitionList
Parameters:
 PartListNode  - SUBPARTS node
 SubpartitionType - HASH, LIST or ''
 ColListNode   - COL_LIST node
 TabBlocksize  - BLOCKSIZE at table level
******************************************************************** -->
  <xsl:element name="SUBPARTITION_LIST">
   <xsl:for-each select="$PartListNode/SUBPARTS_ITEM">
    <xsl:element name="SUBPARTITION_LIST_ITEM">
     <xsl:element name="NAME">
      <xsl:value-of select="SCHEMA_OBJ/SUBNAME"/>
     </xsl:element>
     <xsl:if test="HIBOUNDVAL">
      <xsl:element name="VALUES">
       <xsl:value-of select="HIBOUNDVAL"/>
      </xsl:element>
     </xsl:if>
     <!-- storage -->
     <xsl:if test="$VERSION>=1202000000">
      <!-- this section was copied from the SegmentAttributes template -->
      <xsl:choose>
       <xsl:when test="(string-length(BLOCKSIZE)!=0 and DEFERRED_STG)">
        <xsl:call-template name="DoDeferredStg">
         <xsl:with-param name="DeferredStg" select="DEFERRED_STG"/>
         <xsl:with-param name="BlockSize" select="BLOCKSIZE | $TabBlocksize"/>
         <xsl:with-param name="IsSubpartition">1</xsl:with-param>
        </xsl:call-template>
       </xsl:when>
       <xsl:when test="string-length(BLOCKSIZE)!=0 and STORAGE">
        <xsl:call-template name="StorageClause">
         <xsl:with-param name="StorageNode" select="STORAGE"/>
         <xsl:with-param name="BlkSize" select="BLOCKSIZE"/>
         <xsl:with-param name="IsSubpartition">1</xsl:with-param>
        </xsl:call-template>
       </xsl:when>
       <xsl:when test="string-length($TabBlocksize)!=0 and STORAGE">
        <xsl:call-template name="StorageClause">
         <xsl:with-param name="StorageNode" select="STORAGE"/>
         <xsl:with-param name="BlkSize" select="$TabBlocksize"/>
         <xsl:with-param name="IsSubpartition">1</xsl:with-param>
        </xsl:call-template>
       </xsl:when>
      </xsl:choose>
     </xsl:if>
     <!-- Generate INDEXING node if indexing is OFF for this partition -->
     <xsl:if test="$VERSION>=1200000000 and (FLAGS mod  256) >= 128">
      <xsl:element name="INDEXING">OFF</xsl:element>
     </xsl:if>
     <!-- Partitioning storage clause (SQL p. 16-24): tablespace,
          TBS: overflow tablespace (any examples?) -->
     <xsl:call-template name="Tablespace">
      <xsl:with-param name="ParentNode" select="."/>
     </xsl:call-template>
     <!-- don't do table compression for index subpartition (type#=35)
          or for hash subpartition -->
     <xsl:if test="SCHEMA_OBJ/TYPE_NUM!=35
                   and $SubpartitionType!='HASH'">
      <xsl:choose>
       <xsl:when test="DEFERRED_STG">
        <xsl:call-template name="DoDeferredStgSegCompress">
         <xsl:with-param name="DeferredStg" select="DEFERRED_STG"/>
        </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
        <xsl:call-template name="DoSegCompress">
         <xsl:with-param name="Compress" select="STORAGE/FLAGS"/>
        </xsl:call-template>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:if>
     <xsl:apply-templates select="ILM_POLICIES"/>
     <!-- UNUSABLE index partitions (type#=20) or subpartitions (type#=35) -->
     <xsl:if test="(SCHEMA_OBJ/TYPE_NUM=20 or SCHEMA_OBJ/TYPE_NUM=35) and (FLAGS mod 2)>=1">
      <xsl:element name="UNUSABLE"/>
     </xsl:if>
     <!-- column properties: LOB storage clause, varray col properties -->
     <xsl:if test="LOBS/LOBS_ITEM">
      <xsl:call-template name="PartLobStorage">
       <xsl:with-param name="PartListItemNode" select="."/>
       <xsl:with-param name="PartitionType" select="$SubpartitionType"/>
       <xsl:with-param name="ColListNode" select="$ColListNode"/>
       <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
       <xsl:with-param name="PartitioningStorage">1</xsl:with-param>
      </xsl:call-template>
     </xsl:if>
    </xsl:element>
   </xsl:for-each>
  </xsl:element>
 </xsl:template>
 <xsl:template name="PartLobStorage">
  <xsl:param name="PartListItemNode" select="''"/>
  <xsl:param name="PartitionType" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="PartitioningStorage">0</xsl:param>
  <!-- *******************************************************************
Template: PartLobStorage - COLUMN_PROPERTIES: Lob, Varray, and Nested_table col properties
     at the partition level
Parameters:
 PartListItemNode  - PART_LIST_ITEM node or COMPART_LIST_ITEM node
                     or SUBPARTS_ITEM node
 PartitionType - RANGE, LIST, HASH, etc.
 ColListNode   - COL_LIST node
 TabBlocksize  - BLOCKSIZE at table level
  ParitioningStorage - non-0 = This is partitioning storage,
                               i.e., lob storage specified for a 
                               subpartition
******************************************************************** -->
  <!-- blob (type 113)
      opaque (type 58) that is not for XMLTYPE column
      clob (type 112) that is not lob storage for XMLTYPE column
         (since LOB STORE AS is not allowed at the partition level)
      varray (type 123) with collection storage and not HASH partition
      and not system-generated (PROPERTY bit 0x100 (256) not set)
      and varray column is specified as part of partition storage
          and varray name is not system generated
      and ignore unused columns (PROPERTY bit 0x8000 32768)
 -->
  <xsl:if test="($ColListNode/COL_LIST_ITEM[TYPE_NUM=113
                          and (32768>(PROPERTY mod 65536))
                          and (256>(PROPERTY mod 512))]) or
   ($ColListNode/COL_LIST_ITEM[TYPE_NUM=58 
                          and (32768>(PROPERTY mod 65536))
                          and not (OPQMD and OPQMD/TYPE=1)
                          and (256>(PROPERTY mod 512))]) or
   ($ColListNode/COL_LIST_ITEM[TYPE_NUM=112 
                          and (32768>(PROPERTY mod 65536))
                          and not (OPQMD and OPQMD/TYPE=1)
                          and (256>(PROPERTY mod 512))]) or
   ($ColListNode/COL_LIST_ITEM[TYPE_NUM=122]) or
   ($ColListNode/COL_LIST_ITEM[TYPE_NUM=123
                          and (32768>(PROPERTY mod 65536))
                          and ((TYPEMD/FLAGS mod 128)>=64
                               or ((TYPEMD/FLAGS mod 16) >= 8
                                    and (4>($PartListItemNode/LOBS/LOBS_ITEM/SCHEMA_OBJ/FLAGS mod 8))))
                          and (256>(PROPERTY mod 512))]
                          and $PartitionType!='HASH')">
   <xsl:element name="COLUMN_PROPERTIES">
    <xsl:element name="COL_LIST">
     <!-- Loop through all of the LOBS and VARRAYs -->
     <xsl:for-each select="$PartListItemNode/LOBS/LOBS_ITEM">
      <!-- same test as above only for this particular LOBS_ITEM -->
      <xsl:if test="($ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM
                                 and (32768>(PROPERTY mod 65536))
                                 and TYPE_NUM=113
                                 and (256>(PROPERTY mod 512))]) or
         ($ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM
                                 and (32768>(PROPERTY mod 65536))
                                 and TYPE_NUM=58 
                                 and not (OPQMD and OPQMD/TYPE=1)
                                 and (256>(PROPERTY mod 512))]) or
         ($ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM
                                 and (32768>(PROPERTY mod 65536))
                                 and TYPE_NUM=112 
                                 and not (OPQMD and OPQMD/TYPE=1)
                                 and (256>(PROPERTY mod 512))]) or
         ($ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM
                                 and (32768>(PROPERTY mod 65536))
                                 and TYPE_NUM=123
                                 and ((TYPEMD/FLAGS mod 128)>=64
                                 or   ((TYPEMD/FLAGS mod 16) >= 8
                                       and (4>($PartListItemNode/LOBS/LOBS_ITEM/SCHEMA_OBJ/FLAGS mod 8))))
                                 and (256>(PROPERTY mod 512))]
                                 and $PartitionType!='HASH')">
       <xsl:element name="COL_LIST_ITEM">
        <!-- NAME and DATATYPE -->
        <xsl:call-template name="ColNameType">
         <xsl:with-param name="ColListItem" select="$ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM]"/>
        </xsl:call-template>
        <xsl:choose>
         <xsl:when test="$ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM]/TYPE_NUM=123">
          <!-- Varray -->
          <xsl:element name="VARRAY_PROPERTIES">
           <xsl:element name="STORE_AS">LOB</xsl:element>
           <xsl:call-template name="LobColProperties">
            <xsl:with-param name="LobNode" select="."/>
            <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
            <xsl:with-param name="PartitioningStorage" select="$PartitioningStorage"/>
           </xsl:call-template>
          </xsl:element>
         </xsl:when>
         <xsl:otherwise>
          <xsl:call-template name="LobColProperties">
           <xsl:with-param name="LobNode" select="."/>
           <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
           <xsl:with-param name="PartitioningStorage" select="$PartitioningStorage"/>
          </xsl:call-template>
         </xsl:otherwise>
        </xsl:choose>
       </xsl:element>
       <!-- COL_LIST_ITEM -->
      </xsl:if>
      <!-- Loop through all of the NESTED_TABLE descriptions -->
     </xsl:for-each>
     <!-- If there is a Nested Table then add NESTED_TABLE_PROPERTIES node. -->
     <xsl:if test="$PartListItemNode/NT/NTS/NTS_ITEM">
      <xsl:call-template name="PartNTStorage">
       <xsl:with-param name="PartListItemNode" select="$PartListItemNode"/>
       <xsl:with-param name="PartitionType" select="$PartitionType"/>
       <xsl:with-param name="ColListNode" select="$ColListNode"/>
       <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
      </xsl:call-template>
     </xsl:if>
    </xsl:element>
    <!-- COL_LIST -->
   </xsl:element>
   <!-- COLUMN_PROPERTIES -->
  </xsl:if>
 </xsl:template>
 <xsl:template name="PartNTStorage">
  <xsl:param name="PartListItemNode" select="''"/>
  <xsl:param name="PartitionType" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="PartitioningStorage">0</xsl:param>
  <!-- *******************************************************************
Template: PartNTStorage - COLUMN_PROPERTIES: Nested Table col properties
     at the partition level
Parameters:
 PartListItemNode  - PART_LIST_ITEM node or COMPART_LIST_ITEM node
                     or SUBPARTS_ITEM node
 PartitionType - RANGE, LIST, HASH, etc.
 ColListNode   - COL_LIST node
 TabBlocksize  - BLOCKSIZE at table level
  ParitioningStorage - non-0 = This is partitioning storage,
                               i.e., lob storage specified for a 
                               subpartition
******************************************************************** -->
  <xsl:if test="($ColListNode/COL_LIST_ITEM[TYPE_NUM=122]
                          and $PartitionType!='HASH')">
   <xsl:for-each select="$PartListItemNode/NT/NTS/NTS_ITEM">
    <!-- same test as above only for this particular NTS_ITEM -->
    <xsl:if test="($ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM]
                                 and $PartitionType!='HASH')">
     <xsl:element name="COL_LIST_ITEM">
      <!-- NAME and DATATYPE -->
      <xsl:call-template name="ColNameType">
       <xsl:with-param name="ColListItem" select="$ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM]"/>
      </xsl:call-template>
      <!-- NESTED_TABLE_PROPERTES -->
      <xsl:call-template name="NestedTableColProperties">
       <xsl:with-param name="NTNode" select="$PartListItemNode/NT"/>
       <xsl:with-param name="IntcolNum" select="$PartListItemNode/NT/NTS/NTS_ITEM/INTCOL_NUM"/>
       <xsl:with-param name="PartitionFlag">1</xsl:with-param>
      </xsl:call-template>
     </xsl:element>
     <!-- COL_LIST_ITEM -->
    </xsl:if>
   </xsl:for-each>
  </xsl:if>
 </xsl:template>
 <xsl:template name="PartitioningStorageClause">
  <xsl:param name="TableNode" select="''"/>
  <xsl:param name="PartListItemNode" select="''"/>
  <!-- *******************************************************************
Template: PartitioningStorageClause (for hash partitions)
Parameters:
 TableNode         - TABLE_T node
 PartListItemNode  - PART_LIST_ITEM node
******************************************************************** -->
  <xsl:element name="SEGMENT_ATTRIBUTES">
   <xsl:call-template name="DeferredSegmentCreationClause">
    <xsl:with-param name="TableNode" select="$TableNode"/>
    <xsl:with-param name="PartNode" select="$PartListItemNode"/>
   </xsl:call-template>
   <xsl:call-template name="Tablespace">
    <xsl:with-param name="ParentNode" select="$PartListItemNode"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="HashPartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: HashPartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:element name="HASH_PARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$PartobjNode/PARTCOLS"/>
   </xsl:call-template>
   <xsl:call-template name="DefaultPhysicalProperties">
    <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
   <xsl:call-template name="PartitionList">
    <xsl:with-param name="PartListNode" select="$PartobjNode/PART_LIST"/>
    <xsl:with-param name="PartitionType">HASH</xsl:with-param>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="ListPartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: ListPartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:element name="LIST_PARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$PartobjNode/PARTCOLS"/>
   </xsl:call-template>
   <xsl:call-template name="DefaultPhysicalProperties">
    <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
   <!-- automatic option added in 12.2 -->
   <xsl:if test="($PartobjNode/PARTOBJ/FLAGS mod 128)>=64 and $VERSION>=1202000000">
    <xsl:element name="AUTOMATIC"/>
    <xsl:apply-templates select="$PartobjNode/PARTOBJ/INSERT_TS_LIST"/>
   </xsl:if>
   <xsl:call-template name="PartitionList">
    <xsl:with-param name="PartListNode" select="$PartobjNode/PART_LIST"/>
    <xsl:with-param name="PartitionType">LIST</xsl:with-param>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="SystemPartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: SystemPartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:element name="SYSTEM_PARTITIONING">
   <xsl:call-template name="DefaultPhysicalProperties">
    <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
   <xsl:call-template name="PartitionList">
    <xsl:with-param name="PartListNode" select="$PartobjNode/PART_LIST"/>
    <xsl:with-param name="PartitionType">SYSTEM</xsl:with-param>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="ReferencePartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: ReferencePartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:element name="REFERENCE_PARTITIONING">
   <!-- Here we assume there is exactly one referential constraint governing the reference partitioning -->
   <xsl:for-each select="CON2_LIST/CON2_LIST_ITEM">
    <xsl:if test="(FLAGS mod 1024)>=512">
     <xsl:element name="CONSTRAINT">
      <xsl:value-of select="NAME"/>
     </xsl:element>
    </xsl:if>
   </xsl:for-each>
   <xsl:call-template name="DefaultPhysicalProperties">
    <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
   <xsl:call-template name="PartitionList">
    <xsl:with-param name="PartListNode" select="$PartobjNode/PART_LIST"/>
    <xsl:with-param name="PartitionType">REFERENCE</xsl:with-param>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="CompositePartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="PartitionType" select="''"/>
  <xsl:param name="PropertyNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="TableNode" select="''"/>
  <!-- *******************************************************************
Template: CompositePartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 PartitionType- RANGE, HASH, LIST or ''
 PropertyNode - PROPERTY node
 ColListNode  - COL_LIST node
 TabBlocksize - BLOCKSIZE at table level
 TableNode: TABLE_T
******************************************************************** -->
  <xsl:call-template name="DoPartColList">
   <xsl:with-param name="PartcolsNode" select="$PartobjNode/PARTCOLS"/>
  </xsl:call-template>
  <xsl:call-template name="DefaultPhysicalProperties">
   <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
   <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
   <xsl:with-param name="TableNode" select="$TableNode"/>
  </xsl:call-template>
  <xsl:apply-templates select="$PartobjNode/PARTOBJ/INTERVAL_STR"/>
  <xsl:if test="$PartitionType='LIST' and ($PartobjNode/PARTOBJ/FLAGS mod 128)>=64 and $VERSION>=1202000000">
   <xsl:element name="AUTOMATIC"/>
  </xsl:if>
  <xsl:apply-templates select="$PartobjNode/PARTOBJ/INSERT_TS_LIST"/>
  <xsl:if test="$PARTITIONING=1">
   <xsl:choose>
    <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=1">
     <xsl:call-template name="RangeSubpartitioning">
      <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
      <xsl:with-param name="ColListNode" select="$ColListNode"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=2">
     <xsl:call-template name="HashSubpartitioning">
      <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
      <xsl:with-param name="ColListNode" select="$ColListNode"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=4">
     <xsl:call-template name="ListSubpartitioning">
      <xsl:with-param name="PartobjNode" select="$PartobjNode"/>
      <xsl:with-param name="ColListNode" select="$ColListNode"/>
     </xsl:call-template>
    </xsl:when>
   </xsl:choose>
   <xsl:call-template name="PartitionList">
    <xsl:with-param name="PartListNode" select="$PartobjNode/COMPART_LIST"/>
    <xsl:with-param name="PartitionType" select="$PartitionType"/>
    <xsl:with-param name="SubpartitionType">
     <xsl:choose>
      <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=1">RANGE</xsl:when>
      <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=2">HASH</xsl:when>
      <xsl:when test="($PartobjNode/PARTOBJ/SPARE2 mod 256)=4">LIST</xsl:when>
     </xsl:choose>
    </xsl:with-param>
    <xsl:with-param name="PropertyNode" select="$PropertyNode"/>
    <xsl:with-param name="ColListNode" select="$ColListNode"/>
    <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
    <xsl:with-param name="TableNode" select="$TableNode"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="HashSubpartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <!-- *******************************************************************
Template: HashSubpartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 ColListNode  - COL_LIST node
******************************************************************** -->
  <xsl:element name="HASH_SUBPARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$PartobjNode/SUBPARTCOLS"/>
   </xsl:call-template>
   <xsl:if test="$VERSION>=1200000000 and (FLAGS mod  256) >= 128">
    <xsl:element name="INDEXING">OFF</xsl:element>
   </xsl:if>
   <xsl:choose>
    <!-- subpartition template -->
    <xsl:when test="$PartobjNode/TSUBPARTS/TSUBPARTS_ITEM">
     <xsl:element name="SUBPARTITION_TEMPLATE">
      <xsl:element name="SUBPARTITION_LIST">
       <xsl:for-each select="$PartobjNode/TSUBPARTS/TSUBPARTS_ITEM">
        <xsl:call-template name="SubpartitionTemplateItem">
         <xsl:with-param name="ColListNode" select="$ColListNode"/>
        </xsl:call-template>
       </xsl:for-each>
      </xsl:element>
     </xsl:element>
    </xsl:when>
    <!-- subpartition count -->
    <!-- number of subpartitions is bytes 2-3 of SPARE2 -->
    <xsl:when test="(floor(($PartobjNode/PARTOBJ/SPARE2) div 65536) mod 65536) > 0">
     <xsl:element name="SUBPARTITION_COUNT">
      <xsl:value-of select="(floor(($PartobjNode/PARTOBJ/SPARE2) div 65536) mod 65536)"/>
     </xsl:element>
    </xsl:when>
   </xsl:choose>
  </xsl:element>
 </xsl:template>
 <xsl:template name="ListSubpartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <!-- *******************************************************************
Template: ListSubpartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 ColListNode  - COL_LIST node
******************************************************************** -->
  <xsl:element name="LIST_SUBPARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$PartobjNode/SUBPARTCOLS"/>
   </xsl:call-template>
   <!-- automatic option deferred until 12.2.0.2
    <xsl:if test="($PartobjNode/PARTOBJ/FLAGS mod 65536)>=32768 and $VERSION>=1202000000">
     <xsl:element name="AUTOMATIC"/>
    </xsl:if>
   -->
   <xsl:if test="$PartobjNode/TSUBPARTS/TSUBPARTS_ITEM">
    <xsl:element name="SUBPARTITION_TEMPLATE">
     <xsl:element name="SUBPARTITION_LIST">
      <xsl:for-each select="$PartobjNode/TSUBPARTS/TSUBPARTS_ITEM">
       <xsl:call-template name="SubpartitionTemplateItem">
        <xsl:with-param name="ColListNode" select="$ColListNode"/>
       </xsl:call-template>
      </xsl:for-each>
     </xsl:element>
    </xsl:element>
   </xsl:if>
  </xsl:element>
 </xsl:template>
 <xsl:template name="RangeSubpartitioning">
  <xsl:param name="PartobjNode" select="''"/>
  <xsl:param name="ColListNode" select="''"/>
  <!-- *******************************************************************
Template: RangeSubpartitioning
Parameters:
 PartobjNode  - PART_OBJ node
 ColListNode  - COL_LIST node
******************************************************************** -->
  <xsl:element name="RANGE_SUBPARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$PartobjNode/SUBPARTCOLS"/>
   </xsl:call-template>
   <!--interval option added in 12.2 -->
   <xsl:if test="$VERSION>=1202000000">
    <xsl:apply-templates select="$PartobjNode/PARTOBJ/SUBINTERVAL_STR"/>
   </xsl:if>
   <xsl:if test="$PartobjNode/TSUBPARTS/TSUBPARTS_ITEM">
    <xsl:element name="SUBPARTITION_TEMPLATE">
     <xsl:element name="SUBPARTITION_LIST">
      <xsl:for-each select="$PartobjNode/TSUBPARTS/TSUBPARTS_ITEM">
       <xsl:call-template name="SubpartitionTemplateItem">
        <xsl:with-param name="ColListNode" select="$ColListNode"/>
       </xsl:call-template>
      </xsl:for-each>
     </xsl:element>
    </xsl:element>
   </xsl:if>
  </xsl:element>
 </xsl:template>
 <xsl:template name="SubpartitionTemplateItem">
  <xsl:param name="ColListNode" select="''"/>
  <!-- *******************************************************************
Template: SubpartitionTemplateItem
Current Node: TSUBPARTS_ITEM
Parameters:
 ColListNode   - COL_LIST node
******************************************************************** -->
  <xsl:element name="SUBPARTITION_LIST_ITEM">
   <xsl:element name="NAME">
    <xsl:value-of select="SPART_NAME"/>
   </xsl:element>
   <xsl:if test="HIBOUNDVAL">
    <xsl:element name="VALUES">
     <xsl:value-of select="HIBOUNDVAL"/>
    </xsl:element>
   </xsl:if>
   <xsl:if test="$VERSION>=1200000000 and
                 (FLAGS mod  256) >= 128">
    <xsl:element name="INDEXING">OFF</xsl:element>
   </xsl:if>
   <xsl:call-template name="Tablespace">
    <xsl:with-param name="ParentNode" select="."/>
   </xsl:call-template>
   <!-- inmemory columnar - compress, load, map/mirror-->
   <!--relevant bits in template subpartion template (defsubpart$.flags from kkpac.h):
#define KKPACFRAG_TEMPLATE_IMC_ENABLED    (ub4) 0x200       /* IMC specified */ 1
#define KKPACFRAG_TEMPLATE_IMC_NOTENABLED (ub4) 0x400   /* IMC not specified */ 2
#define KKPACFRAG_TEMPLATE_IMC_MIRRORMAP  (ub4) 0x800   /* IMC mirror or map */ 4
#define KKPACFRAG_TEMPLATE_IMC_LEVEL1  (ub4)0x1000     /* IMC nocomp or comp */ 8
#define KKPACFRAG_TEMPLATE_IMC_PRELOAD (ub4)0x2000/* IMC ondemand or preload */ 16
#define KKPACFRAG_TEMPLATE_IMC_MAPBY1  (ub4)0x4000      /* IMC rowid or part */ 32
#define KKPACFRAG_TEMPLATE_IMC_MAPBY2  (ub4)0x8000    /* IMC part or subpart */
#define KKPACFRAG_TEMPLATE_IMC_LEVEL2  (ub4)0x10000  /* IMC comp low or high */ 128
#define KKPACFRAG_TEMPLATE_IMC_PPRI_NONE (ub4)0x20000/* IMC preload priority */ 256 mod 32
#define KKPACFRAG_TEMPLATE_IMC_PPRI_LOW  (ub4)0x40000      /* priority - LOW */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_MEDIUM (ub4)0x80000 /* priority - MEDIUM */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_HIGH   (ub4)0x100000  /* priority - HIGH */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_CRITICAL (ub4)0x200000       /* CRITICAL */
#define KKPACFRAG_TEMPLATE_IMC_PPRI_MASK     (ub4)0x3e0000  /* priority MASK */
#define KKPACFRAG_TEMPLATE_IMC_FORCED  (ub4)0x400000           /* IMC forced */
#define KKPACFRAG_TEMPLATE_IMC_LEVEL3  (ub4)0x800000/* IMCcomp qry(0) cap(1) */ 16384 mod 4
#define KKPACFRAG_TEMPLATE_IMC_LEVEL4  (ub4)0x1000000         /* IMC memcomp */
#define KKPACFRAG_TEMPLATE_IMC_DUPLICATE1  (ub4)0x2000000   /* IMC duplicate */ 65536 mod 4
#define KKPACFRAG_TEMPLATE_IMC_DUPLICATE2  (ub4)0x4000000   /* IMC duplicate */
 we div by 512, to put 'enable' at bit 0. The decimal numbers above are based on that!-->
   <xsl:variable name="IMCsegflag" select="floor(FLAGS div 512)"/>
   <xsl:variable name="Enabled" select="$IMCsegflag mod 2"/>
   <xsl:variable name="Disabled" select="floor($IMCsegflag div 2) mod 2"/>
   <xsl:variable name="MirrorMap" select="floor($IMCsegflag div 4) mod 2"/>
   <xsl:variable name="Level1" select="floor($IMCsegflag div 8) mod 2"/>
   <xsl:variable name="Preload" select="floor($IMCsegflag div 16) mod 2"/>
   <xsl:variable name="MapBy12" select="floor($IMCsegflag div 32) mod 4"/>
   <xsl:variable name="Level2" select="floor($IMCsegflag div 128) mod 2"/>
   <xsl:variable name="Priority" select="floor($IMCsegflag div 256) mod 32"/>
   <xsl:variable name="Level34" select="floor($IMCsegflag div 16384) mod 4"/>
   <!-- storage is allocated, params are in SEG$ - aka the STORAGE element. -->
   <xsl:call-template name="xDoInMemory">
    <xsl:with-param name="InMemory">
     <xsl:choose>
      <xsl:when test="$Enabled=1">
       <xsl:text>1</xsl:text>
      </xsl:when>
      <xsl:when test="$Disabled=1">
       <xsl:text>2</xsl:text>
      </xsl:when>
      <xsl:otherwise>
       <xsl:text>0</xsl:text>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:with-param>
    <xsl:with-param name="Priority">
     <xsl:choose>
      <xsl:when test="$Preload=1">
       <!-- above test 'PRELOAD'=1, then we decode the 5 bits of priority-->
       <xsl:choose>
        <xsl:when test="$Priority=1">
         <xsl:text>0</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=2">
         <xsl:text>1</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=4">
         <xsl:text>2</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=8">
         <xsl:text>4</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=16">
         <xsl:text>6</xsl:text>
        </xsl:when>
        <xsl:otherwise>
         <xsl:text>5</xsl:text>
        </xsl:otherwise>
       </xsl:choose>
      </xsl:when>
      <xsl:when test="$Preload=0 and $Priority=0">
       <xsl:text>7</xsl:text>
      </xsl:when>
      <xsl:otherwise>
       <xsl:text>0</xsl:text>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:with-param>
    <xsl:with-param name="Compression" select="($Level34*4)+($Level2*2)+$Level1"/>
    <xsl:with-param name="Distribute" select="($MapBy12*2)+$MirrorMap"/>
    <xsl:with-param name="Duplicate" select="floor($IMCsegflag div 65536) mod 4"/>
    <xsl:with-param name="ServiceName">
     <xsl:if test="SVCFLAGS">
      <xsl:choose>
       <xsl:when test="SVCFLAGS=1">
        <xsl:text>DEFAULT</xsl:text>
       </xsl:when>
       <xsl:when test="SVCFLAGS=2">
        <xsl:text>NONE</xsl:text>
       </xsl:when>
       <xsl:when test="SVCFLAGS=3">
        <xsl:text>ALL</xsl:text>
       </xsl:when>
       <xsl:when test="SVCFLAGS=4">
        <xsl:value-of select="SVCNAME"/>
       </xsl:when>
       <xsl:otherwise>DEFAULT</xsl:otherwise>
      </xsl:choose>
     </xsl:if>
    </xsl:with-param>
   </xsl:call-template>
   <xsl:if test="TLOBS/TLOBS_ITEM">
    <xsl:element name="COLUMN_PROPERTIES">
     <xsl:element name="COL_LIST">
      <xsl:for-each select="TLOBS/TLOBS_ITEM">
       <xsl:element name="COL_LIST_ITEM">
        <!-- NAME and DATATYPE -->
        <xsl:call-template name="ColNameType">
         <xsl:with-param name="ColListItem" select="$ColListNode/COL_LIST_ITEM[INTCOL_NUM=current()/INTCOL_NUM]"/>
        </xsl:call-template>
        <xsl:element name="LOB_PROPERTIES">
         <xsl:element name="STORAGE_TABLE">
          <xsl:element name="SCHEMA">
           <xsl:value-of select="$ColListNode/../SCHEMA_OBJ/OWNER_NAME"/>
          </xsl:element>
          <xsl:element name="NAME">
           <xsl:value-of select="LOB_SPART_NAME"/>
          </xsl:element>
          <xsl:call-template name="Tablespace">
           <xsl:with-param name="ParentNode" select="."/>
          </xsl:call-template>
         </xsl:element>
        </xsl:element>
       </xsl:element>
      </xsl:for-each>
     </xsl:element>
    </xsl:element>
   </xsl:if>
  </xsl:element>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO