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

<?xml version="1.0"?>
<!-- Copyright (c) 2000, 2017, Oracle and/or its affiliates. 
All rights reserved.-->
<!--
NAME
    kustorag.xsl
DESCRIPTION
    XSLT stylesheet for XML => DDL conversion of storage parameters
NOTES
    Do NOT modify this file under any circumstance. If you wish to use this
    stylesheet with an external XML/XSL parser, first make a copy then reverse
    the comments on any xsl:import statements appearing below.

MODIFIED        MM/DD/YY
    jjanosik    06/01/17 - Bug 24803693: Don't emit PCTFREE if
                           TABLE_COMPRESSION_CLAUSE is set
    jjanosik    05/30/17 - Bug 25673825: Add a space before storage syntax
    rapayne     04/26/17 - Bug 25732728: TABLE_COMPRESSION_CLAUSE is not getting
                           applied if the table does not already have compress
                           attributes defined.
    jjanosik    04/10/17 - Bug 24517168: Add storage to subpartitions
    tbhukya     03/21/17 - Bug 25747729: Fix table and index compression
    bwright     03/10/17 - Bug 25326861: Fix INITRANS of part. cluster
    rapayne     02/12/17 - Bug 23303529: Fix deferred stg for nested tables.
    tbhukya     10/03/16 - Bug 24784766: MAXSIZE is not valid at sub-partition
    dvekaria    09/13/16 - Bug 24655256: Space required to separate
                           ROWDEPENDENCIES.
    jjanosik    07/14/16 - Bug 23752742: fix OLTP compression condition
    sdavidso    07/04/16 - sharding exchange-out support
    tbhukya     06/09/16 - Bug 22171888: Support CELLMEMORY
    tbhukya     05/13/16 - Bug 23248862: Correct mod for result_cache clause
    tbhukya     04/29/16 - Bug 23035753: Add storage clause at sub-partition
    rapayne     01/30/16 - bug 22611512: fix variable Transportable
    tbhukya     11/17/15 - RTI 18737676
    tbhukya     09/28/15 - Bug 21822338: Support INDEX COMPRESS
    sogugupt    03/03/15 - Ensure additional space in between 
                           RETURN AS VALUE/PARALLEL clause.
    rapayne     02/10/15 - lrg 15074144: overflow clause with deferred stg
                           does not process LOGGING attrib correctly.
    rapayne     01/27/15 - lrg 14979799 - change no compression flag for 
                                        DoDeferredStg template.
    tbhukya     01/05/15 - Bug 20319428: Declare referred params and import
                           xsl files for referred templates
    rapayne     09/22/14 - don't generate COMPRESS clause for MVIEW_LOG
                           objects.
    lbarton     05/14/14 - bug 18746312: don't import view-as-table with
                           transportable params
    bwright     08/16/13 - Bug 17312600: Remove hard tabs from DP src code
    rapayne     03/12/13 - bug 15924364: new oltp compression syntax
    rapayne     11/09/12 - bug 15839049: name change for row level locking:
                           ROW LEVEL LOCKING <- ROW_LEVEL_LOCKING
    dvekaria    07/05/12 - Bug13443703.
    rapayne     12/25/11 - proj 37634: Partial Index support.
    lbarton     11/30/11 - 36954_dpump_tabcluster_zonemap
    lbarton     09/14/11 - project 32935: row level locking
    lbarton     07/29/11 - 32948_lob_storage
    lbarton     07/12/11 - 32135_table_compression_clause
    sdavidso    05/06/11 - more full/transportable work
    sdavidso    03/30/11 - support TRANSPORTABLE xml element
    tbhukya     12/23/10 - Bug 10350240 : Add space before CACHE
    tbhukya     10/06/10 - Bug 10154862 : Generate BUFFER_POOL and LOGGING
                           clauses in seperate line.
    lbarton     04/26/10 - bug 9650606: more dsc details
    lbarton     02/12/10 - lrg 4478962: logging in partitions
    lbarton     11/20/09 - TABLE_COMPRESSION param
    mjangir     10/17/09 - bug 9027492: ensure additional space before CACHE
    lbarton     08/27/09 - bug 8820324: support all values in deferred_stg
    lbarton     08/14/09 - bug 8795792: no compress/logging in deferred stg for
                           indexes
    lbarton     06/15/09 - more archive compression syntax changes
    rapayne     06/05/09 - suppress compression clause when SEGMENT_ATTRIBUTES 
                           are not enabled.
    lbarton     11/20/08 - archive level compression
    lbarton     03/18/09 - deferred storage and compression
    adalee      03/09/09 - new cache hints in addition to BUFFER_POOL
    lbarton     02/18/09 - bug 8252494: more deferred segment creation
    tbhukya     12/10/08 - Bug 7630483: table parallel instances 
    mbastawa    02/25/08 - fixed the result cache bit fields
    lbarton     01/16/08 - Bug 6724820: table compression
    sdavidso    07/25/07 - OLTP Compression factoring - partition default
    lbarton     08/02/07 - RESULT_CACHE
    sdavidso    05/16/07 - OLTP Compression factoring
    slynn       10/12/06 - smartfile->securefile
    weizhang    06/12/06 - proj 18567: support LOBRETENTION and MAXSIZE
    lbarton     01/25/06 - add comments 
    sdavidso    11/02/05 - fix inconsistent stylesheet format 
    htseng      10/19/05 - bug 4120481: fix 9.2 for emit MONITOR 
    lbarton     05/11/04 - Bug 3617842: SAMPLE and PCTSPACE 
    htseng      03/30/04 - bug 3531991: table ROWDEPENDENCIES  
    lbarton     10/21/02 - add PARALLEL, RESET_PARALLEL params
    lbarton     08/02/02 - transportable export
    lbarton     06/13/02 - don't emit MONITOR if EXPORT flag on
    lbarton     01/04/02 - remove extra )
    dgagne      11/05/01 - remove row movement from partitions
    dgagne      10/15/01 - add heap segment compression support
    dgagne      06/14/01 - add support for tablespace, rollback, and
                           materialized view
    lbarton     10/30/00 - fix STORAGE and TABLESPACE tests
    gclaborn    11/03/00 - change name
    lbarton     10/05/00 - bugfix: parallel
    lbarton     06/23/00 - MONITORING
    lbarton     06/12/00 - parallel clause
    lbarton     05/15/00 - Params for new API
    lbarton     04/06/00 - Partitioning support
    lbarton     03/17/00 - Add module header
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- Needed for template DoAllLogging -->
 <xsl:import href="kucommon.xsl"/>
 <!-- Params referred in this stylesheet -->
 <xsl:param name="STORAGE">1</xsl:param>
 <xsl:param name="PCTSPACE">100</xsl:param>
 <xsl:param name="PRETTY">1</xsl:param>
 <xsl:param name="SQLTERMINATOR">0</xsl:param>
 <xsl:param name="SEGMENT_ATTRIBUTES">1</xsl:param>
 <xsl:param name="SHARD_TABLESPACE"/>
 <xsl:param name="TABLESPACE">1</xsl:param>
 <xsl:param name="VERSION">9999999999</xsl:param>
 <xsl:param name="TABLE_COMPRESSION">1</xsl:param>
 <xsl:param name="TABLE_COMPRESSION_CLAUSE" select="''"/>
 <xsl:param name="TRANSPORTABLE">0</xsl:param>
 <xsl:param name="EXPORT">0</xsl:param>
 <!-- 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>
 <!-- Templates -->
 <xsl:template match="PCT_FREE | DEFPCTFREE">
  <xsl:param name="ADT_type">TABLE</xsl:param>
  <xsl:param name="PartFlag">0</xsl:param>
  <!-- *******************************************************************
Template: PCT_FREE | DEFPCTFREE
 Emit PCTFREE, PCTUSED (for tables only), INITRANS, MAXTRANS
Parameters:
 ADT_type: "TABLE" or "INDEX" or "ZONEMAP" or "CLUSTER"
 PartFlag: 1 if for a partition,  0 otherwise
******************************************************************** -->
  <xsl:if test="$SEGMENT_ATTRIBUTES=1">
   <xsl:if test="string-length($Table_Compression_Clause)=0 or 
                 $Table_Compression_Clause='NONE'">
    <xsl:text>PCTFREE </xsl:text>
    <xsl:value-of select="."/>
   </xsl:if>  
   <xsl:if test="not($ADT_type='INDEX')">
    <xsl:text> PCTUSED </xsl:text>
    <xsl:value-of select="../PCT_USED"/>
    <xsl:value-of select="../DEFPCTUSED"/>
   </xsl:if>
   <xsl:if test="not($ADT_type='ZONEMAP')">
    <xsl:text> INITRANS </xsl:text>
    <xsl:choose>
     <!-- Bug 25326861: Work around bug 21557769 -->
     <xsl:when test="$ADT_type='CLUSTER' and $PartFlag=1 and ../INITRANS=1">
      <xsl:text>2</xsl:text>
     </xsl:when>
     <xsl:when test="$ADT_type='CLUSTER' and $PartFlag=1 and ../DEFINITRANS=1">
      <xsl:text>2</xsl:text>
     </xsl:when>
     <xsl:otherwise>
      <xsl:value-of select="../INITRANS"/>
      <xsl:value-of select="../DEFINITRANS"/>
     </xsl:otherwise>
    </xsl:choose>
    <xsl:text> MAXTRANS </xsl:text>
    <xsl:value-of select="../MAXTRANS"/>
    <xsl:value-of select="../DEFMAXTRANS"/>
    <xsl:text> </xsl:text>
   </xsl:if>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoParallel">
  <xsl:param name="ADT_type">TABLE</xsl:param>
  <xsl:param name="FlagsParent" select="''"/>
  <xsl:param name="SetParallel">-1</xsl:param>
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <!-- *******************************************************************
Template: DoParallel
  Emit a bunch of things:
   ROWDEPENDENCIES
   MONITORING
   PARALLEL
Parameters:
 ADT_type: "TABLE" or "INDEX"
 FlagsParent: Parent of FLAGS node (also parent of PROPERTY2)
 SetParallel: user-specified value for PARALLEL (if > 0)
 MVIEW_LOG: 1 = generate attributes for materialized view log
******************************************************************** -->
  <xsl:choose>
   <xsl:when test="$PRETTY=1 and 
                   (not($ADT_type='INDEX') and 
                   (($FlagsParent/FLAGS mod 16)>=8 or
                   ($FlagsParent/PROPERTY2 mod 1024)>=512 or
                   ($FlagsParent/PROPERTY2 mod 2048)>=1024 or
                   ($MVIEW_LOG=0 and ($FlagsParent/FLAGS mod 4194304)>=2097152))
                   or $FlagsParent/DEGREE)">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:when>
   <xsl:otherwise>
    <xsl:if test="(($FlagsParent/FLAGS mod 16)>=8 or
                   ($FlagsParent/PROPERTY2 mod 1024)>=512 or
                   ($FlagsParent/PROPERTY2 mod 2048)>=1024 or 
                   ($MVIEW_LOG=0 and ($FlagsParent/FLAGS mod 4194304)>=2097152) or 
                   ((($FlagsParent/PROPERTY2 mod 2048)=0) and $FlagsParent/DEGREE))">
     <xsl:text> </xsl:text>
    </xsl:if>
   </xsl:otherwise>
  </xsl:choose>
  <!-- ROWDEF 0x0800000 -->
  <!-- check objType - Indexes might have INDEXING attrib flags bits set. -->
  <xsl:if test="not($ADT_type='INDEX') and
                       $FlagsParent/FLAGS mod 16777216>=8388608">
   <xsl:text> ROWDEPENDENCIES </xsl:text>
  </xsl:if>
  <xsl:if test="not($ADT_type='INDEX')">
   <xsl:if test="($FlagsParent/PROPERTY2 mod 1024)>=512">RESULT_CACHE(MODE FORCE) </xsl:if>
   <xsl:if test="($FlagsParent/PROPERTY2 mod 2048)>=1024">RESULT_CACHE(MODE MANUAL) </xsl:if>
   <xsl:if test="($FlagsParent/FLAGS mod 16)>=8"> CACHE </xsl:if>
   <xsl:if test="$EXPORT=0">
    <xsl:if test="$MVIEW_LOG=0 and ($FlagsParent/FLAGS mod 4194304)>=2097152">MONITORING </xsl:if>
   </xsl:if>
  </xsl:if>
  <xsl:choose>
   <xsl:when test="0>$SetParallel">
    <xsl:choose>
     <xsl:when test="$FlagsParent/DEGREE">
      <xsl:text>PARALLEL </xsl:text>
      <xsl:choose>
       <!-- old syntax: PARALLEL (DEGREE n INSTANCES m) -->
       <xsl:when test="32767>$FlagsParent/INSTANCES">
        <xsl:text>(</xsl:text>
        <xsl:choose>
         <xsl:when test="$FlagsParent/DEGREE=32767">DEGREE DEFAULT</xsl:when>
         <xsl:otherwise>
          <xsl:text>DEGREE </xsl:text>
          <xsl:value-of select="$FlagsParent/DEGREE"/>
         </xsl:otherwise>
        </xsl:choose>
        <xsl:choose>
         <xsl:when test="32767>$FlagsParent/INSTANCES">
          <xsl:text> INSTANCES </xsl:text>
          <xsl:value-of select="$FlagsParent/INSTANCES"/>
         </xsl:when>
        </xsl:choose>
        <xsl:text>) </xsl:text>
       </xsl:when>
       <xsl:when test="(32767>$FlagsParent/DEGREE) and ($FlagsParent/INSTANCES=32767)">
        <xsl:text>(DEGREE </xsl:text>
        <xsl:value-of select="$FlagsParent/DEGREE"/>
        <xsl:text> INSTANCES DEFAULT) </xsl:text>
       </xsl:when>
       <!-- new syntax PARALLEL [n] -->
       <xsl:otherwise>
        <xsl:if test="32767>$FlagsParent/DEGREE">
         <xsl:value-of select="$FlagsParent/DEGREE"/>
         <xsl:text> </xsl:text>
        </xsl:if>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
      <xsl:if test="$FlagsParent/INSTANCES">
       <xsl:text>PARALLEL </xsl:text>
       <xsl:choose>
        <xsl:when test="32767>=$FlagsParent/INSTANCES">
         <xsl:text>(</xsl:text>
         <xsl:choose>
          <xsl:when test="$FlagsParent/INSTANCES=32767"> INSTANCES DEFAULT</xsl:when>
          <xsl:when test="32767>$FlagsParent/INSTANCES">
           <xsl:text> INSTANCES </xsl:text>
           <xsl:value-of select="$FlagsParent/INSTANCES"/>
          </xsl:when>
         </xsl:choose>
         <xsl:text>) </xsl:text>
        </xsl:when>
       </xsl:choose>
      </xsl:if>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
   <!-- user-specified value -->
   <xsl:otherwise>
    <xsl:choose>
     <xsl:when test="$SetParallel=0">
      <xsl:text>NOPARALLEL </xsl:text>
     </xsl:when>
     <xsl:when test="$SetParallel>32767">
      <xsl:text>PARALLEL </xsl:text>
     </xsl:when>
     <xsl:otherwise>
      <xsl:text>PARALLEL </xsl:text>
      <xsl:value-of select="$SetParallel"/>
      <xsl:text> </xsl:text>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template match="STORAGE">
  <xsl:param name="PARTITION">0</xsl:param>
  <xsl:param name="Nested">0</xsl:param>
  <xsl:param name="BlkSize">0</xsl:param>
  <xsl:param name="ObjType">0</xsl:param>
  <xsl:param name="Dataobjnum">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <xsl:param name="Subpartition">0</xsl:param>
  <!--TRANSPORTABLE is valid for TABLE and TABLESPACE export, not DATABASE export.
We define TransportObject to mean the current object is moved using trasportable-->
  <xsl:variable name="TransportObject">
   <xsl:choose>
    <xsl:when test="$TRANSPORTABLE = 1">1</xsl:when>
    <xsl:when test='$TRANSPORTABLE = 2 and 
                 .//TRANSPORTABLE="1"'>1</xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <!-- *******************************************************************
Template: STORAGE - 
Parameters:
 PARTITION: 1 = storage for a partition
 Nested: 1 = nested table
 BlkSize: value of BLOCKSIZE
 ObjType: null or 'MVIEW' (when called by kumview.xsl)
 Dataobjnum: DATAOBJ_NUM node
 Pctspace: percentage by which space allocation is to be modified
           defaults to 100 (no modification)
 ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:call-template name="NamedStorage">
   <xsl:with-param name="PARTITION" select="$PARTITION"/>
   <xsl:with-param name="Nested" select="$Nested"/>
   <xsl:with-param name="BlkSize" select="$BlkSize"/>
   <xsl:with-param name="ObjType" select="$ObjType"/>
   <xsl:with-param name="Node" select="current()"/>
   <xsl:with-param name="Dataobjnum" select="$Dataobjnum"/>
   <xsl:with-param name="Pctspace" select="$Pctspace"/>
   <xsl:with-param name="TransportObject" select="$TransportObject"/>
   <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
   <xsl:with-param name="Subpartition" select="$Subpartition"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="NamedStorage">
  <xsl:param name="PARTITION">0</xsl:param>
  <xsl:param name="Nested">0</xsl:param>
  <xsl:param name="BlkSize">0</xsl:param>
  <xsl:param name="ObjType">0</xsl:param>
  <xsl:param name="Node" select="''"/>
  <xsl:param name="Dataobjnum">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="TransportObject">0</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <xsl:param name="Subpartition">0</xsl:param>
  <!-- *******************************************************************
Template: NamedStorage - emit STORAGE params and TABLESPACE
Parameters:
 PARTITION: 1 = storage for a partition
 Nested: 1 = nested table
 BlkSize: value of BLOCKSIZE
 ObjType: ROLLBACK, TABLESPACE or ignored
 Node: STORAGE node
 Dataobjnum: DATAOBJ_NUM node
 Pctspace: percentage by which space allocation is to be modified
           defaults to 100 (no modification)
 ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:if test="$SEGMENT_ATTRIBUTES=1">
   <xsl:if test="$STORAGE=1">
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa; </xsl:text>
    </xsl:if>
    <xsl:text> STORAGE(</xsl:text>
    <!-- special segment attributes for transportable tablespaces -->
    <xsl:if test="$TransportObject=1 and $Dataobjnum!=0 and $ViewAsTable=0 and $SHARD_TABLESPACE=''">
     <xsl:text>SEG_FILE </xsl:text>
     <xsl:value-of select="$Node/FILE_NUM"/>
     <xsl:text> SEG_BLOCK </xsl:text>
     <xsl:value-of select="$Node/BLOCK_NUM"/>
     <xsl:text> OBJNO_REUSE </xsl:text>
     <xsl:value-of select="$Dataobjnum"/>
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa; </xsl:text>
     </xsl:if>
     <xsl:text> </xsl:text>
    </xsl:if>
    <!-- If supplied - always output INITIAL -->
    <xsl:if test="($Node/DEFINIEXTS or $Node/INIEXTS or $Node/DFLINIT) and $Subpartition!=1">
     <xsl:text>INITIAL </xsl:text>
     <xsl:choose>
      <xsl:when test="$Node/INIEXTS">
       <xsl:call-template name="DoIniNext">
        <xsl:with-param name="Size" select="$Node/INIEXTS"/>
        <xsl:with-param name="BlkSize" select="$BlkSize"/>
        <xsl:with-param name="Pctspace" select="$Pctspace"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:when test="$Node/DFLINIT">
       <xsl:call-template name="DoIniNext">
        <xsl:with-param name="Size" select="$Node/DFLINIT"/>
        <xsl:with-param name="BlkSize" select="$BlkSize"/>
        <xsl:with-param name="Pctspace" select="$Pctspace"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
       <xsl:call-template name="DoIniNext">
        <xsl:with-param name="Size" select="$Node/DEFINIEXTS"/>
        <xsl:with-param name="BlkSize" select="$BlkSize"/>
        <xsl:with-param name="Pctspace" select="$Pctspace"/>
       </xsl:call-template>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:if>
    <!-- If supplied - always output NEXT -->
    <xsl:if test="($Node/DEFEXTSIZE or $Node/EXTSIZE or $Node/DFLINCR) and $Subpartition!=1">
     <xsl:text> NEXT </xsl:text>
     <xsl:choose>
      <xsl:when test="$Node/EXTSIZE">
       <xsl:call-template name="DoIniNext">
        <xsl:with-param name="Size" select="$Node/EXTSIZE"/>
        <xsl:with-param name="BlkSize" select="$BlkSize"/>
        <xsl:with-param name="Pctspace" select="$Pctspace"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:when test="$Node/DFLINCR">
       <xsl:call-template name="DoIniNext">
        <xsl:with-param name="Size" select="$Node/DFLINCR"/>
        <xsl:with-param name="BlkSize" select="$BlkSize"/>
        <xsl:with-param name="Pctspace" select="$Pctspace"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
       <xsl:call-template name="DoIniNext">
        <xsl:with-param name="Size" select="$Node/DEFEXTSIZE"/>
        <xsl:with-param name="BlkSize" select="$BlkSize"/>
        <xsl:with-param name="Pctspace" select="$Pctspace"/>
       </xsl:call-template>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:if>
    <!-- If supplied - always output MINEXTENTS -->
    <xsl:if test="($Node/DEFMINEXTS or $Node/MINEXTS or $Node/DFLMINEXT) and $Subpartition!=1">
     <xsl:text> MINEXTENTS </xsl:text>
     <xsl:value-of select="$Node/MINEXTS"/>
     <xsl:value-of select="$Node/DFLMINEXT"/>
     <xsl:value-of select="$Node/DEFMINEXTS"/>
    </xsl:if>
    <!-- If supplied - always output MAXEXTENTS -->
    <xsl:if test="($Node/DEFMAXEXTS or $Node/MAXEXTS or $Node/DFLMAXEXT) and $Subpartition!=1">
     <xsl:text> MAXEXTENTS </xsl:text>
     <xsl:value-of select="$Node/MAXEXTS"/>
     <xsl:value-of select="$Node/DFLMAXEXT"/>
     <xsl:value-of select="$Node/DEFMAXEXTS"/>
    </xsl:if>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa; </xsl:text>
    </xsl:if>
    <!-- If supplied and not ROLLBACK - output PCTINCREASE -->
    <xsl:if test="$ObjType != 'ROLLBACK'">
     <xsl:if test="($Node/DEFEXTPCT or $Node/EXTPCT or $Node/DFLEXTPCT) and $Subpartition!=1">
      <xsl:text> PCTINCREASE </xsl:text>
      <xsl:value-of select="$Node/EXTPCT"/>
      <xsl:value-of select="$Node/DFLEXTPCT"/>
      <xsl:value-of select="$Node/DEFEXTPCT"/>
     </xsl:if>
    </xsl:if>
    <!-- If supplied and not ROLLBACK or TABLESPACE
         - output FREELIST, FREELIST GROUPS, BUFFER_POOL, 
           FLASH_CACHE and CELL_FLASH_CACHE -->
    <xsl:if test="($ObjType != 'ROLLBACK') or
                  ($ObjType != 'TABLESPACE')">
     <xsl:if test="(2097152 > ($Node/FLAGS mod 4194304)) and $Subpartition!=1">
      <!-- non 11glob: FREELISTS and FREELIST GROUPS clause -->
      <xsl:if test="$Node/DEFLISTS > 0 or $Node/LISTS">
       <xsl:text> FREELISTS </xsl:text>
       <xsl:value-of select="$Node/LISTS"/>
       <xsl:value-of select="$Node/DEFLISTS"/>
      </xsl:if>
      <xsl:if test="$Node/DEFGROUPS > 0 or $Node/GROUPS">
       <xsl:text> FREELIST GROUPS </xsl:text>
       <xsl:value-of select="$Node/GROUPS"/>
       <xsl:value-of select="$Node/DEFGROUPS"/>
      </xsl:if>
     </xsl:if>
     <!-- MAXSIZE clause -->
     <!-- 11g: BITMAPRANGES => MAXSIZE -->
     <xsl:if test="($Node/BITMAPRANGES and ($Node/FLAGS mod 8388608)>=4194304
                   or $Node/DEFMAXSIZE) and $Subpartition!=1">
      <xsl:call-template name="DoMAXSIZE">
       <xsl:with-param name="MaxSize" select="$Node/BITMAPRANGES | $Node/DEFMAXSIZE"/>
       <xsl:with-param name="BlkSize" select="$BlkSize"/>
      </xsl:call-template>
     </xsl:if>
     <xsl:if test="$Node/CACHEHINT or $Node/DEFBUFPOOL">
      <xsl:if test="(($ObjType != 'ROLLBACK') or ($ObjType != 'TABLESPACE')) and 
                     (($Node/DEFEXTPCT or $Node/EXTPCT or $Node/DFLEXTPCT) or 
                      (2097152 > ($Node/FLAGS mod 4194304) and 
                       ($Node/DEFLISTS > 0 or $Node/LISTS)) or 
                      ($Node/DEFGROUPS > 0 or $Node/GROUPS) or 
                      ($Node/BITMAPRANGES and ($Node/FLAGS mod 8388608)>=4194304 or
                       $Node/DEFMAXSIZE)) and $PRETTY=1 and $Subpartition!=1">
       <xsl:text>&#xa; </xsl:text>
      </xsl:if>
      <xsl:apply-templates select="$Node/CACHEHINT | $Node/DEFBUFPOOL"/>
     </xsl:if>
    </xsl:if>
    <!-- output OPTIMAL if ROLLBACK and OPTIMAL supplied -->
    <xsl:if test="$ObjType = 'ROLLBACK'">
     <xsl:if test="$Node/OPTIMAL">
      <xsl:text> OPTIMAL </xsl:text>
      <xsl:value-of select="$Node/OPTIMAL"/>
     </xsl:if>
    </xsl:if>
    <xsl:text>)</xsl:text>
   </xsl:if>
   <!-- end if storage -->
   <xsl:if test="$TABLESPACE=1">
    <xsl:if test="not($Nested='1')">
     <xsl:apply-templates select="$Node/../TS_NAME"/>
    </xsl:if>
   </xsl:if>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoIniNext">
  <xsl:param name="Size">0</xsl:param>
  <xsl:param name="BlkSize">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: DoIniNext emit the numeric value for INITIAL, NEXT, etc.
Parameters:
 Size: size value in blocks
 BlkSize: value of BLOCKSIZE
 Pctspace: percentage by which space allocation is to be modified
           defaults to 100 (no modification)
******************************************************************** -->
  <xsl:choose>
   <xsl:when test="string-length($Pctspace)!=0 and $Pctspace!=100">
    <xsl:value-of select="round($Size*$BlkSize*$Pctspace*0.01)"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="$Size*$BlkSize"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template match="TS_NAME | DEFTS_NAME">
  <xsl:param name="NewLine">1</xsl:param>
  <!-- *******************************************************************
Template: TS_NAME | DEFTS_NAME - emit TABLESPACE ts_name
Parameters:
 NewLine: 1 = emit newline if PRETTY is on
******************************************************************** -->
  <xsl:if test="$TABLESPACE=1 and $SEGMENT_ATTRIBUTES=1">
   <xsl:if test="$PRETTY=1 and $NewLine=1">
    <xsl:text>&#xa; </xsl:text>
   </xsl:if>
   <xsl:text> TABLESPACE "</xsl:text>
   <xsl:choose>
    <xsl:when test="$SHARD_TABLESPACE=''">
     <xsl:value-of select="."/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="$SHARD_TABLESPACE"/>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:text>" </xsl:text>
  </xsl:if>
 </xsl:template>
 <xsl:template match="CACHEHINT | DEFBUFPOOL | BFP_STG">
  <!-- *******************************************************************
Template: CACHEHINT | DEFBUFPOOL - 
          emit BUFFER_POOL/FLASH_CACHE/CELL_FLASH_CACHE
******************************************************************** -->
  <!-- BUFFER_POOL is the least significant 2 bits (bit [0-1]) -->
  <xsl:text> BUFFER_POOL </xsl:text>
  <xsl:choose>
   <xsl:when test="(. mod 4)=1">KEEP</xsl:when>
   <xsl:when test="(. mod 4)=2">RECYCLE</xsl:when>
   <xsl:otherwise>DEFAULT</xsl:otherwise>
  </xsl:choose>
  <!-- new cachehint FLASH_CACHE/ CELL_FLASH_CACHE requires 11.2 comp -->
  <xsl:if test="$VERSION>=1102000000">
   <!-- FLASH_CACHE is the next 2 bits (bit [2-3]) -->
   <xsl:text> FLASH_CACHE </xsl:text>
   <xsl:choose>
    <xsl:when test="floor((. mod 16) div 4)=1">KEEP</xsl:when>
    <xsl:when test="floor((. mod 16) div 4)=2">NONE</xsl:when>
    <xsl:otherwise>DEFAULT</xsl:otherwise>
   </xsl:choose>
   <!-- CELL_FLASH_CACHE is the next 2 bits (bit [4-5]) -->
   <xsl:text> CELL_FLASH_CACHE </xsl:text>
   <xsl:choose>
    <xsl:when test="floor((. mod 64) div 16)=1">KEEP</xsl:when>
    <xsl:when test="floor((. mod 64) div 16)=2">NONE</xsl:when>
    <xsl:otherwise>DEFAULT</xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>
 <xsl:template match="LISTS | GROUPS">
  <!-- *******************************************************************
Template: LISTS | GROUPS
******************************************************************** -->
  <xsl:choose>
   <xsl:when test=".=0">1</xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="."/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="DoMAXSIZE">
  <!-- *******************************************************************
Template: DoMAXSIZE
Parameters:
 MaxSize: Maxsimum Size
 BlkSize: Block Size
******************************************************************** -->
  <xsl:param name="MaxSize">0</xsl:param>
  <xsl:param name="BlkSize">0</xsl:param>
  <xsl:choose>
   <xsl:when test="$MaxSize=0"/>
   <!-- do nothing if KTSDFMSZP or KTSDFMSZ -->
   <xsl:when test="$MaxSize=4294967295 or $MaxSize=2147483645"/>
   <!-- export UNLIMITED if larger than KTSMXMSZ * SSTPBLCK -->
   <xsl:when test="($MaxSize * $BlkSize) >= (2147483646 * 512)">
    <xsl:text> MAXSIZE UNLIMITED</xsl:text>
   </xsl:when>
   <!-- export in the format of MB if larger than SB4MAXVAL -->
   <xsl:when test="($MaxSize * $BlkSize) > 2147483647">
    <xsl:text> MAXSIZE </xsl:text>
    <xsl:value-of select="floor(($MaxSize * $BlkSize) div 1048576)"/>
    <xsl:text>M</xsl:text>
   </xsl:when>
   <xsl:otherwise>
    <xsl:text> MAXSIZE </xsl:text>
    <xsl:value-of select="$MaxSize * $BlkSize"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="DoDefStorage">
  <xsl:param name="Node" select="''"/>
  <xsl:param name="BlkSize">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: DoDefStorage - Utility template for default clauses
Parameters:
 Node: parent of DEFINIEXTS, etc.
 BlkSize: value of BLOCKSIZE
 Pctspace: percentage by which space allocation is to be modified
           defaults to 100 (no modification)
******************************************************************** -->
  <xsl:if test="$STORAGE=1 and $SEGMENT_ATTRIBUTES=1">
   <xsl:if test="$Node/DEFINIEXTS or
                 $Node/DEFEXTSIZE or 
                 $Node/DEFMINEXTS or 
                 $Node/DEFMAXEXTS or 
                 $Node/DEFEXTPCT or 
                 ($Node/DEFLISTS and $Node/DEFLISTS!=0) or 
                 ($Node/DEFGROUPS and $Node/DEFGROUPS!=0) or 
                 ($Node/DEFMAXSIZE and $Node/DEFMAXSIZE!=0) or
                 $Node/DEFBUFPOOL">
    <xsl:choose>
     <xsl:when test="$Node/DEFBLOCKSIZE>0">
      <xsl:call-template name="NamedStorage">
       <xsl:with-param name="PARTITION" select="0"/>
       <xsl:with-param name="Nested" select="0"/>
       <xsl:with-param name="BlkSize" select="$Node/DEFBLOCKSIZE"/>
       <xsl:with-param name="ObjType" select="'TABLE'"/>
       <xsl:with-param name="Node" select="$Node"/>
       <xsl:with-param name="Pctspace" select="$Pctspace"/>
      </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="NamedStorage">
       <xsl:with-param name="PARTITION" select="0"/>
       <xsl:with-param name="Nested" select="0"/>
       <xsl:with-param name="BlkSize" select="$BlkSize"/>
       <xsl:with-param name="ObjType" select="'TABLE'"/>
       <xsl:with-param name="Node" select="$Node"/>
       <xsl:with-param name="Pctspace" select="$Pctspace"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:if>
  </xsl:if>
 </xsl:template>
 <xsl:template match="DEFLOGGING">
  <!-- *******************************************************************
Template: DEFLOGGING
******************************************************************** -->
  <xsl:choose>
   <xsl:when test=".=1"> LOGGING </xsl:when>
   <xsl:when test=".=2"> NOLOGGING </xsl:when>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="DoDeferredCompress">
  <xsl:param name="DeferredStg" select="''"/>
  <!-- *******************************************************************
Template: DoDeferredCompress - Emit [NO]COMPRESS for deferred segment
Parameters:
  DeferredStg - DEFERRED_STORAGE node
******************************************************************** -->
  <xsl:call-template name="DoCompressSyntax">
   <xsl:with-param name="isCompressed" select="($DeferredStg/FLAGS_STG mod 8)>=4"/>
   <xsl:with-param name="isOLTPCompressed" select="$DeferredStg/CMPFLAG_STG=2"/>
   <xsl:with-param name="isArchCompressed" select="$DeferredStg/CMPFLAG_STG=3"/>
   <xsl:with-param name="compressLevel" select="$DeferredStg/CMPLVL_STG"/>
   <xsl:with-param name="rowLevelLocking" select="($DeferredStg/FLAGS_STG mod 1048576)>=524288"/>
  </xsl:call-template>
 </xsl:template>
 <!-- **************************************************************
Template: DoPartObjCMemoryCompress: Generate object level cellmemory
                                    for a partitioned table.
  Parameter:
    CMCompress : Cellmemory flag value
******************************************************************** -->
 <xsl:template name="DoPartObjCMemoryCompress">
  <xsl:param name="CMCompress">0</xsl:param>
  <!--  131072   - No Cellmemory
        262144   - Cellmemory enabled
        524288   - memcompress for query
       1048576   - memcompress for capacity
    -->
  <xsl:variable name="flagNoCMemory">131072</xsl:variable>
  <xsl:variable name="flagCMemory">262144</xsl:variable>
  <xsl:variable name="flagCMCompressQuery">524288</xsl:variable>
  <xsl:variable name="flagCMCompressCapacity">1048576</xsl:variable>
  <xsl:call-template name="DoCMemoryCompressSyntax">
   <xsl:with-param name="isNoCMemory" select="($CMCompress mod ($flagNoCMemory*2)>=$flagNoCMemory)"/>
   <xsl:with-param name="isCMemory" select="($CMCompress mod ($flagCMemory*2)>=$flagCMemory)"/>
   <xsl:with-param name="isCMCompressQuery" select="($CMCompress mod ($flagCMCompressQuery*2)>=$flagCMCompressQuery)"/>
   <xsl:with-param name="isCMCompressCapacity" select="($CMCompress mod ($flagCMCompressCapacity*2)>=$flagCMCompressCapacity)"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="DoCMemoryCompress">
  <xsl:param name="CMCompress">0</xsl:param>
  <!-- ***********************************************************************
Template: DoCMemoryCompress - emit CELLMEMORY MEMCOMPRESS FOR QUERY|CAPACITY

              seg$.spare1:
                   #define KTSSEGM_FLAG_CC_ENABLED      ((ub8)0x0800000000000)
                   #define KTSSEGM_FLAG_CC_NOT_ENABLED  ((ub8)0x1000000000000)
                   #define KTSSEGM_FLAG_CC_IFC          ((ub8)0x2000000000000)
                   #define KTSSEGM_FLAG_CC_QUERY        ((ub8)0x4000000000000)
                   #define KTSSEGM_FLAG_CC_CAPACITY     ((ub8)0x8000000000000)

Parameters:
  CMCompress: Node with STORAGE/FLAGS2 value
************************************************************************** -->
  <xsl:variable name="flagNoCMemory">65536</xsl:variable>
  <xsl:variable name="flagCMemory">131072</xsl:variable>
  <xsl:variable name="flagCMCompressQuery">262144</xsl:variable>
  <xsl:variable name="flagCMCompressCapacity">524288</xsl:variable>
  <xsl:call-template name="DoCMemoryCompressSyntax">
   <xsl:with-param name="isNoCMemory" select="($CMCompress mod ($flagNoCMemory*2)>=$flagNoCMemory)"/>
   <xsl:with-param name="isCMemory" select="($CMCompress mod ($flagCMemory*2)>=$flagCMemory)"/>
   <xsl:with-param name="isCMCompressQuery" select="($CMCompress mod ($flagCMCompressQuery*2)>=$flagCMCompressQuery)"/>
   <xsl:with-param name="isCMCompressCapacity" select="($CMCompress mod ($flagCMCompressCapacity*2)>=$flagCMCompressCapacity)"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="DoSegCompress">
  <xsl:param name="Compress">0</xsl:param>
  <xsl:param name="Subpartition">0</xsl:param>
  <!-- *******************************************************************
Template: DoSegCompress - emit [NO]COMPRESS for leaf partition
                          or non-partitioned table
             seg$.spare1:
                   /* #define KTSSEGM_FLAG_COMPRESSED 0x0800    (2048) */
                   /* #define KTSSEGM_FLAG_OLTP  0x1000000  (16777216) */
                   /* #define KTSSEGM_FLAG_ARCH1 0x2000000  (33554432) */
                   /* #define KTSSEGM_FLAG_ARCH2 0x4000000  (67108864) */
                   /* #define KTSSEGM_FLAG_ARCH3 0x8000000 (134217728) */
       /* #define KTSSEGM_FLAG_HCC_ROW_LOCKING 0x80000000 (2147483648) */
          (names defined in ktscts.h)
  OLTP compression only valid in 11.1 and later
  archive compression only valid in 11.2 and later
  row level locking only valid in 12c and later
Parameters:
  Compress: Node with the compression bit
******************************************************************** -->
  <xsl:variable name="flagCompressed">2048</xsl:variable>
  <xsl:variable name="isCompressed" select="($Compress mod ($flagCompressed * 2))>=$flagCompressed"/>
  <xsl:variable name="flagOLTPCompressed">16777216</xsl:variable>
  <xsl:variable name="isOLTPCompressed" select="($Compress mod ($flagOLTPCompressed * 2))>=$flagOLTPCompressed"/>
  <xsl:variable name="flagArch1">33554432</xsl:variable>
  <xsl:variable name="compressLevel" select="floor(($Compress mod ($flagArch1 * 8)) div $flagArch1)"/>
  <xsl:variable name="isArchCompressed" select="$compressLevel!=0"/>
  <xsl:variable name="rllBit">2147483648</xsl:variable>
  <xsl:variable name="rllOn" select="($Compress mod ($rllBit * 2))>=$rllBit"/>
  <xsl:call-template name="DoCompressSyntax">
   <xsl:with-param name="isCompressed" select="$isCompressed"/>
   <xsl:with-param name="isOLTPCompressed" select="$isOLTPCompressed"/>
   <xsl:with-param name="isArchCompressed" select="$isArchCompressed"/>
   <xsl:with-param name="compressLevel" select="$compressLevel"/>
   <xsl:with-param name="rowLevelLocking" select="$rllOn"/>
   <xsl:with-param name="Subpartition" select="$Subpartition"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="DoPartOBJCompress">
  <xsl:param name="Compress">0</xsl:param>
  <!-- *******************************************************************
Template: DoPartOBJCompress - emit [NO]COMPRESS default value
          for subpartitions of a composite partitioned table
  [from dpart.bsq]
  /*  compression attribute of the partition */
  /*            following bit patterns are possible: */
  /*            00000000 : Compression not specified */
  /*            00000001 : Compression enabled for direct load operations */
  /*            00000010 : Compression disabled      */
  /*            00000101 : Compression enabled for all operations */
  /*            00001001 : Archive Compression: level 1 */
  /*            00010001 : Archive Compression: level 2 */
  /*            00011001 : Archive Compression: level 3 */
  /*            00100001 : Archive Compression: level 4 */
  /*            00101001 : Archive Compression: level 5 */
  /*            00110001 : Archive Compression: level 6 */
  /*            00111001 : Archive Compression: level 7 */
  /*            01001001 : query low row level locking  */
  /*            01010001 : query high row level locking  */
  /*            01011001 : archive low row level locking  */
  /*            01100001 : archive high row level locking  */
  These are stored in byte 4 of partobj$.spare2 or byte 0 of tabcompart$.spare2
Parameters:
  Compress: byte containing the partition compression attribute
******************************************************************** -->
  <xsl:variable name="locCompress" select="floor($Compress)"/>
  <xsl:variable name="flagCompressed">1</xsl:variable>
  <xsl:variable name="isCompressed" select="($locCompress mod ($flagCompressed * 2))>=$flagCompressed"/>
  <xsl:variable name="flagOLTPCompressed">4</xsl:variable>
  <xsl:variable name="isOLTPCompressed" select="($Compress mod ($flagOLTPCompressed * 2))>=$flagOLTPCompressed"/>
  <xsl:variable name="flagArch1">8</xsl:variable>
  <xsl:variable name="compressLevel" select="floor(($locCompress mod ($flagArch1 * 8)) div $flagArch1)"/>
  <xsl:variable name="isArchCompressed" select="$compressLevel!=0"/>
  <xsl:variable name="rllBit">64</xsl:variable>
  <xsl:variable name="rllOn" select="($Compress mod ($rllBit * 2))>=$rllBit"/>
  <!-- If there are compression attributes set or compress has been requested
       with the TABLE_COMPRESSION_CLAUSE parameter call DoPartOBJCompress.
       otherwise dont emit any compression clause.
       Note: TABLE_COMPRESSION_CLAUSE must not be applied during a
       transportable operation. The mixed case Table_Compression_Clause variable
       (defined in kuprtobj) accounts for this and will not reflect the actual
       transform param when transportable is set.
  -->
  <xsl:if test="($locCompress!=0 or string-length($Table_Compression_Clause) !=0)">
   <xsl:call-template name="DoCompressSyntax">
    <xsl:with-param name="isCompressed" select="$isCompressed"/>
    <xsl:with-param name="isOLTPCompressed" select="$isOLTPCompressed"/>
    <xsl:with-param name="isArchCompressed" select="$isArchCompressed"/>
    <xsl:with-param name="compressLevel" select="$compressLevel"/>
    <xsl:with-param name="rowLevelLocking" select="$rllOn"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoTSCompress">
  <xsl:param name="Compress">0</xsl:param>
  <xsl:param name="Compress2">0</xsl:param>
  <!-- *******************************************************************
Template: DoTSCompress - emit [NO]COMPRESS value for tablespaces
             ts$.flags:
              /* #define KTT_COMPRESSED               0x40 (64)              */
              /* #define KTT_OLTP_COMPRESSION   0x10000(65536)   */
#define KTT_ARCH1_COMPRESSION  ((ub4)0x20000)    /* Archive compressed table */
#define KTT_ARCH2_COMPRESSION  ((ub4)0x40000)    /* Archive compressed table */
#define KTT_ARCH3_COMPRESSION  ((ub4)0x80000)    /* Archive compressed table */
#define KTT_HCC_ROW_LOCKING    ((ub4)0x400000) /* Row level locking with HCC 
                                                                 compression */
#define KTT_IDX_COMPRESSED      ((ub8)0x1000000000000)
/* Type of index compression */
#define KTT_ADVLOW_COMPRESSION  ((ub8)0x2000000000000)       /* Advanced Low */
#define KTT_ADVHIGH_COMPRESSION ((ub8)0x4000000000000)      /* Advanced High */
#define KTT_TBL_COMPRESSED ((ub8)0x8000000000000) /* Tables compressed */

Note: KTT_TBL_COMPRESSED detected in Compress2 using variable flagCompressed2

Note: Changes in this template should probably be duplicated in kusstorg.xsl

Parameters:
  Compress: Node with the compression bits
******************************************************************** -->
  <xsl:variable name="locCompress" select="floor($Compress)"/>
  <xsl:variable name="flagCompressed">64</xsl:variable>
  <xsl:variable name="flagCompressed2">524288</xsl:variable>
  <xsl:variable name="isCompressed" select="($locCompress mod ($flagCompressed * 2))>=$flagCompressed"/>
  <xsl:variable name="isTableCompressed" select="($Compress2 mod ($flagCompressed2 * 2))>=$flagCompressed2"/>
  <xsl:variable name="flagOLTPCompressed">65536</xsl:variable>
  <xsl:variable name="isOLTPCompressed" select="($Compress mod ($flagOLTPCompressed * 2))>=$flagOLTPCompressed"/>
  <xsl:variable name="flagArch1">131072</xsl:variable>
  <xsl:variable name="compressLevel" select="floor(($locCompress mod ($flagArch1 * 8)) div $flagArch1)"/>
  <xsl:variable name="isArchCompressed" select="$compressLevel!=0"/>
  <xsl:variable name="rllBit">4194304</xsl:variable>
  <xsl:variable name="rllOn" select="($Compress mod ($rllBit * 2))>=$rllBit"/>
  <xsl:variable name="flag2IndexCompressed">65536</xsl:variable>
  <xsl:variable name="isIndexCompressed" select="($Compress2 mod ($flag2IndexCompressed * 2))>=$flag2IndexCompressed"/>
  <xsl:variable name="flag2IndexCompressedAdvLow">131072</xsl:variable>
  <xsl:variable name="isIndexCompressedAdvLow" select="($Compress2 mod ($flag2IndexCompressedAdvLow * 2))>=$flag2IndexCompressedAdvLow"/>
  <xsl:variable name="flag2IndexCompressedAdvHigh">262144</xsl:variable>
  <xsl:variable name="isIndexCompressedAdvHigh" select="($Compress2 mod ($flag2IndexCompressedAdvHigh * 2))>=$flag2IndexCompressedAdvHigh"/>
  <xsl:call-template name="DoCompressSyntax">
   <xsl:with-param name="isCompressed" select="$isCompressed"/>
   <xsl:with-param name="isTableCompressed" select="$isTableCompressed"/>
   <xsl:with-param name="isOLTPCompressed" select="$isOLTPCompressed"/>
   <xsl:with-param name="isArchCompressed" select="$isArchCompressed"/>
   <xsl:with-param name="compressLevel" select="$compressLevel"/>
   <xsl:with-param name="rowLevelLocking" select="$rllOn"/>
   <xsl:with-param name="isIndexCompressed" select="$isIndexCompressed"/>
   <xsl:with-param name="isIndexCompressedAdvLow" select="$isIndexCompressedAdvLow"/>
   <xsl:with-param name="isIndexCompressedAdvHigh" select="$isIndexCompressedAdvHigh"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="DoCompressSyntax">
  <xsl:param name="isCompressed" select="false()"/>
  <xsl:param name="isTableCompressed" select="false()"/>
  <xsl:param name="isOLTPCompressed" select="false()"/>
  <xsl:param name="isArchCompressed" select="false()"/>
  <xsl:param name="isIndexCompressed" select="false()"/>
  <xsl:param name="isIndexCompressedAdvLow" select="false()"/>
  <xsl:param name="isIndexCompressedAdvHigh" select="false()"/>
  <xsl:param name="compressLevel">0</xsl:param>
  <xsl:param name="rowLevelLocking">0</xsl:param>
  <xsl:param name="Subpartition">0</xsl:param>
  <!-- *******************************************************************
Template: DoCompressSyntax - common template to emit [NO]COMPRESS 
Parameters:
  isCompressed
  isOLTPCompressed
  isArchCompressed - archive compressed
  compressLevel - archive compression level
  rowLevelLocking - 1 = ROW LEVEL LOCKING (for archive compression)
  Subpartition 1 = this is a subpartition (0 = it isn't)
Implicit input (transform parameters):
  SEGMENT_ATTRIBUTES - omit clause if segment attributes disabled
  TABLE_COMPRESSION (undocumented) - omit clause if this param set false
  TABLE_COMPRESSION_CLAUSE - use this value if present
  Transportable - ignore TABLE_COMPRESSION_CLAUSE if Transportable=1
  VERSION - see notes
Notes:
  Archive level compression is new in 11.2 and has a unique block format
  which is not supported in earlier versions.  Consequently, if VERSION
  is earlier than 11.2, we must specify NOCOMPRESS.
  On the other hand, the block formats for OLTP compression (new in 11.1)
  and DIRECT_LOAD are the same, so if VERSION < 11.1 we can specify COMPRESS.
  (Update: in 11.2 COMPRESS FOR ALL OPERATIONS is renamed COMPRESS FOR OLTP;
   COMPRESS FOR DIRECT_LOAD_OPERATIONS is renamed COMPRESS FOR BASIC.)
  ROW LEVEL LOCKING syntax is new in 12c; suppress for lower versions.
******************************************************************** -->
  <!-- Set compression attributes if there are attributes set or have
       been requested with the TABLE_COMPRESSION_CLAUSE parameter
  -->
  <xsl:if test="($SEGMENT_ATTRIBUTES=1 and $TABLE_COMPRESSION=1) or 
                 (string-length($Table_Compression_Clause) != 0)">
   <xsl:choose>
    <xsl:when test="$PRETTY=1 and $Table_Compression_Clause!='NONE'">
     <xsl:text>&#xa; </xsl:text>
    </xsl:when>
    <xsl:otherwise>
     <xsl:text> </xsl:text>    
    </xsl:otherwise>
   </xsl:choose>
   <xsl:choose>
    <xsl:when test="string-length($Table_Compression_Clause)!=0">
     <xsl:choose>
      <xsl:when test="$Table_Compression_Clause='NONE'"/>
      <xsl:otherwise>
       <xsl:value-of select="$Table_Compression_Clause"/>
       <xsl:text> </xsl:text>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:when>
    <xsl:when test=" $isCompressed and $isArchCompressed">
     <xsl:choose>
      <xsl:when test="$VERSION>=1102000000">
       <xsl:if test="$VERSION>=1200000000">
        <xsl:text>COLUMN STORE </xsl:text>
       </xsl:if>
       <xsl:choose>
        <xsl:when test="$compressLevel=1">COMPRESS FOR QUERY LOW </xsl:when>
        <xsl:when test="$compressLevel=2">COMPRESS FOR QUERY HIGH </xsl:when>
        <xsl:when test="$compressLevel=3">COMPRESS FOR ARCHIVE LOW </xsl:when>
        <xsl:when test="$compressLevel=4">COMPRESS FOR ARCHIVE HIGH </xsl:when>
        <xsl:otherwise>
         <xsl:text>**INVALID COMPRESSION VALUE (</xsl:text>
         <xsl:value-of select="$compressLevel"/>
         <xsl:text>)** </xsl:text>
        </xsl:otherwise>
       </xsl:choose>
       <xsl:choose>
        <xsl:when test="$VERSION &lt; 1200000000"/>
        <xsl:when test="$rowLevelLocking=1">ROW LEVEL LOCKING </xsl:when>
        <xsl:otherwise>NO ROW LEVEL LOCKING </xsl:otherwise>
       </xsl:choose>
      </xsl:when>
      <xsl:otherwise>NOCOMPRESS </xsl:otherwise>
     </xsl:choose>
    </xsl:when>
    <xsl:when test="$isCompressed and $isOLTPCompressed">
     <xsl:choose>
      <xsl:when test="$VERSION>=1200000000">ROW STORE COMPRESS ADVANCED </xsl:when>
      <xsl:when test="$VERSION>=1102000000">COMPRESS FOR OLTP </xsl:when>
      <xsl:when test="$VERSION>=1100000000">COMPRESS FOR ALL OPERATIONS </xsl:when>
      <xsl:otherwise>COMPRESS </xsl:otherwise>
     </xsl:choose>
    </xsl:when>
    <xsl:when test="$VERSION>=1202000000 and 
                    ($isTableCompressed or 
                     ($isIndexCompressed and ($isIndexCompressedAdvLow or 
                                              $isIndexCompressedAdvHigh)))">
     <xsl:if test="$isTableCompressed">
      <xsl:text>TABLE </xsl:text>
      <xsl:choose>
       <xsl:when test="$isOLTPCompressed">
        <xsl:text>COMPRESS FOR OLTP </xsl:text>
       </xsl:when>
       <xsl:when test="$isArchCompressed">
        <xsl:choose>
         <xsl:when test="$compressLevel=1">COMPRESS FOR QUERY LOW </xsl:when>
         <xsl:when test="$compressLevel=2">COMPRESS FOR QUERY HIGH </xsl:when>
         <xsl:when test="$compressLevel=3">COMPRESS FOR ARCHIVE LOW </xsl:when>
         <xsl:when test="$compressLevel=4">COMPRESS FOR ARCHIVE HIGH </xsl:when>
         <xsl:otherwise>
          <xsl:text>**INVALID COMPRESSION VALUE (</xsl:text>
          <xsl:value-of select="$compressLevel"/>
          <xsl:text>)** </xsl:text>
         </xsl:otherwise>
        </xsl:choose>
       </xsl:when>
      </xsl:choose>
     </xsl:if>
     <xsl:if test="$isIndexCompressed">
      <xsl:text>INDEX COMPRESS </xsl:text>
      <xsl:if test="$isIndexCompressedAdvLow">
       <xsl:text>ADVANCED LOW </xsl:text>
      </xsl:if>
      <xsl:if test="$isIndexCompressedAdvHigh">
       <xsl:text>ADVANCED HIGH </xsl:text>
      </xsl:if>
     </xsl:if>
    </xsl:when>
    <xsl:when test="$isCompressed">
     <xsl:text>COMPRESS </xsl:text>
     <xsl:if test="$VERSION>=1102000000">BASIC </xsl:if>
    </xsl:when>
    <xsl:otherwise>
     <xsl:if test="$Subpartition=0 or 
                   ($Subpartition=1 and $VERSION>=1100000000)">NOCOMPRESS </xsl:if>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoDeferredStg">
  <xsl:param name="DeferredStg" select="''"/>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="ADT_type">TABLE</xsl:param>
  <xsl:param name="doCompression">1</xsl:param>
  <xsl:param name="doLogging">1</xsl:param>
  <xsl:param name="Partition">0</xsl:param>
  <xsl:param name="BlkSize" select="''"/>
  <xsl:param name="IsSubpartition">0</xsl:param>
  <!-- *******************************************************************
Template: DoDeferredStg - generate storage params when seg creation deferred
Current node: TABLE_T, INDEX_T
Parameters:
  DeferredStg - DEFERRED_STORAGE node
  Pctspace -    value of the PCTSPACE param; defaults to 100
  ADT_type -    TABLE = tables
                INDEX = PIOTs and indexes
                LOB   = lobs
  doCompression - no compress flag. Compression attributes are not valid for
                  MVIEW LOG objects and OVERFLOW clauses for table objs.
  doLogging -   flag to identify whether to process LOGGING attribute. 
                This is necessary because when called from OVERFLOW template
                the current node does NOT contain the relevant FLAGS element.
  Partition -   non-0 = processing a partition
  BlkSize - BLOCKSIZE element is not deterministically referenced from the current_node.
        For NestedTables the blocksize needs to be passed in.
******************************************************************** -->
  <xsl:if test="$DeferredStg">
   <!-- compress and logging not valid for lob storage or MVIEW LOGs-->
   <!-- compress not valid for index -->
   <xsl:if test="$ADT_type = 'TABLE' and $doCompression=1">
    <!-- compression -->
    <xsl:call-template name="DoDeferredCompress">
     <xsl:with-param name="DeferredStg" select="$DeferredStg"/>
    </xsl:call-template>
   </xsl:if>
   <!-- Generate logging attribute if appropriate:
        Note: overflow clauses for PIOTs have already processed the
          LOGGING attribute and more importantly the current node does
           NOT contain the FLAGS node describing logging attrib.
    -->
   <xsl:if test="$doLogging=1">
    <xsl:call-template name="DoAllLogging">
     <xsl:with-param name="FlagsNode" select="FLAGS"/>
     <xsl:with-param name="ADT_type" select="$ADT_type"/>
     <xsl:with-param name="Partition" select="$Partition"/>
    </xsl:call-template>
   </xsl:if>
   <!-- STORAGE: use values in deferred_seg$ -->
   <xsl:variable name="hasINITIAL" select="$DeferredStg and $DeferredStg/INITIAL_STG"/>
   <xsl:variable name="hasNEXT" select="$DeferredStg and $DeferredStg/NEXT_STG"/>
   <xsl:variable name="hasMINEXT" select="$DeferredStg and $DeferredStg/MINEXT_STG"/>
   <xsl:variable name="hasMAXEXT" select="$DeferredStg and $DeferredStg/MAXEXT_STG"/>
   <xsl:variable name="hasPCTINC" select="$DeferredStg and $DeferredStg/PCTINC_STG"/>
   <xsl:variable name="hasMAXSIZE" select="$DeferredStg and $DeferredStg/MAXSIZ_STG"/>
   <xsl:variable name="hasFREELISTS" select="$DeferredStg and $DeferredStg/FRLINS_STG"/>
   <xsl:variable name="hasFREELIST_GROUPS" select="$DeferredStg and $DeferredStg/MAXINS_STG"/>
   <xsl:variable name="hasBUFFER_POOL" select="$DeferredStg and $DeferredStg/BFP_STG"/>
   <!-- variables to help with pretty-printing -->
   <xsl:variable name="hasLine1" select="$hasINITIAL or $hasNEXT or $hasMINEXT or $hasMAXEXT"/>
   <xsl:variable name="hasLine2" select="$hasPCTINC or $hasMAXSIZE or $hasFREELISTS or $hasFREELIST_GROUPS"/>
   <xsl:variable name="hasLine3" select="$hasBUFFER_POOL"/>
   <xsl:if test="$STORAGE=1 and ($hasLine1 or $hasLine2 or $hasLine3)">
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa; </xsl:text>
    </xsl:if>
    <!-- setup a local blocksize variable: if one was passed in we just use it.
           Otherwise we assume we can just reference it from the curren_node.
           Note: nested tables is currently the only time we need to pass it in.
-->
    <xsl:variable name="blocksize">
     <xsl:choose>
      <xsl:when test="$BlkSize">
       <xsl:value-of select="$BlkSize"/>
      </xsl:when>
      <xsl:otherwise>
       <xsl:value-of select="BLOCKSIZE"/>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:variable>
    <xsl:text> STORAGE(</xsl:text>
    <!-- don't do these for subpartitions -->
    <xsl:if test="$IsSubpartition=0">
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">INITIAL</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/INITIAL_STG"/>
      <xsl:with-param name="testval" select="$hasINITIAL"/>
      <xsl:with-param name="mult" select="$blocksize"/>
      <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     </xsl:call-template>
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">NEXT</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/NEXT_STG"/>
      <xsl:with-param name="testval" select="$hasNEXT"/>
      <xsl:with-param name="mult" select="$blocksize"/>
      <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     </xsl:call-template>
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">MINEXTENTS</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/MINEXT_STG"/>
      <xsl:with-param name="testval" select="$hasMINEXT"/>
     </xsl:call-template>
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">MAXEXTENTS</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/MAXEXT_STG"/>
      <xsl:with-param name="testval" select="$hasMAXEXT"/>
     </xsl:call-template>
     <xsl:if test="$PRETTY=1 and $hasLine1 and $hasLine2">
      <xsl:text>&#xa; </xsl:text>
     </xsl:if>
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">PCTINCREASE</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/PCTINC_STG"/>
      <xsl:with-param name="testval" select="$hasPCTINC"/>
      <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     </xsl:call-template>
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">MAXSIZE</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/MAXSIZ_STG"/>
      <xsl:with-param name="testval" select="$hasMAXSIZE"/>
      <xsl:with-param name="mult" select="BLOCKSIZE"/>
      <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     </xsl:call-template>
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">FREELISTS</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/FRLINS_STG"/>
      <xsl:with-param name="testval" select="$hasFREELISTS"/>
     </xsl:call-template>
     <xsl:call-template name="DoDeferredStgParam">
      <xsl:with-param name="ParamName">FREELIST GROUPS</xsl:with-param>
      <xsl:with-param name="ParamVal" select="$DeferredStg/MAXINS_STG"/>
      <xsl:with-param name="testval" select="$hasFREELIST_GROUPS"/>
     </xsl:call-template>
    </xsl:if>
    <xsl:if test="$hasBUFFER_POOL">
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa; </xsl:text>
     </xsl:if>
     <xsl:apply-templates select="$DeferredStg/BFP_STG"/>
    </xsl:if>
    <xsl:text>)</xsl:text>
   </xsl:if>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoDeferredStgParam">
  <xsl:param name="ParamName" select="''"/>
  <xsl:param name="ParamVal" select="''"/>
  <xsl:param name="testval" select="''"/>
  <xsl:param name="mult">1</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: DoDeferredStgParam - Utility template to emit a single
  STORAGE param
Parameters:
  ParamName - name, e.g., INITIAL
  ParamVal - value if any
  testval - true if ParamVal is valid
  mult - factor to multiply ParamVal (e.g., INITIAL is stored as
         a number of blocks, so mult would be the blocksize)
  Pctspace: percentage by which space allocation is to be modified
           defaults to 100 (no modification)
******************************************************************** -->
  <xsl:if test="$testval">
   <xsl:choose>
    <xsl:when test="$ParamName='MAXSIZE'">
     <xsl:call-template name="DoMAXSIZE">
      <xsl:with-param name="MaxSize" select="$ParamVal"/>
      <xsl:with-param name="BlkSize" select="$mult"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:text> </xsl:text>
     <xsl:value-of select="$ParamName"/>
     <xsl:text> </xsl:text>
     <xsl:call-template name="DoIniNext">
      <xsl:with-param name="Size" select="$ParamVal"/>
      <xsl:with-param name="BlkSize" select="$mult"/>
      <xsl:with-param name="Pctspace" select="$Pctspace"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO