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

<?xml version="1.0"?>
<!--

 Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.

NAME
    kusidxwk.xsl
DESCRIPTION
    Common functions for converting mdapi IND/INDEX_T to SXML
MODIFIED        MM/DD/YY
    rapayne     06/12/17 - Bug 26249637: fix col_list from domain indexes.
    rapayne     01/19/17 - Bug 25244974: generate INVISIBLE/COMPRESS attributes
                           for global temp tables.
    tbhukya     11/12/15 - Bug 22171671: Add element nosegment
    tbhukya     11/04/15 - Bug 22125304: Use original column name in index
                           when virtual column created for collation.
    tbhukya     01/05/15 - Bug 20319428: Declare referred param
    sogugupt    11/20/14 - Bug 19819583: INVISIBLE SXML_DDL for INVISIBLE XML INDEX
    bwright     07/03/14 - Bug 19018545: Fix INVISIBLE support: for partitioned
                           index and only for versions greater than 11
    lbarton     04/24/13 - bug 16716831: functional index expression as varchar
                           or clob
    rapayne     12/25/11 - proj 37634: Partial Index support.
    rapayne     06/15/11 - lrg 5665517: fix xmlns violation.
    lbarton     01/07/10 - bug 8796742: translatable error messages
    lbarton     12/28/09 - fix MONITORING_USAGE
    rapayne     07/23/09 - bug 8664468/8592114: context indexes which reference
                           xmlextra cols are converted to OBJECT_VALUE.
    rapayne     07/20/09 - bug 8692388: correct call args to PhysicalAttribute 
                           (i.e., objtype is text rather than a node).
    rapayne     12/15/08 - merge CM statistics support.
    lbarton     09/30/08 - bug 7334782 (again): more xmltype virtual columns
    sdavidso    08/19/08 - bug 7272424: index on system partitioned table
    lbarton     06/18/08 - bug 7188926: parameters in partitioned domain index
    lbarton     01/17/08 - Bug 6724820: table compression
    rapayne     01/10/07 - 
    lbarton     06/23/06 - PARSE_EXPRESSIONS param 
    sdavidso    05/09/06 - support invisible index attribute 
    sdavidso    05/01/06 - support parameters in domain index partitions
    htseng      16/12/05 - add transform param PARTITIONING
    lbarton     11/08/05 - 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="kuspar.xsl"/>
 <!-- Top-level parameters -->
 <xsl:param name="PARTITIONING">1</xsl:param>
 <xsl:param name="STATISTICS">0</xsl:param>
 <xsl:param name="PARSE_EXPRESSIONS">0</xsl:param>
 <!-- Templates -->
 <xsl:template name="DoIndex">
  <xsl:param name="IndNode" select="''"/>
  <xsl:param name="ConstraintIndex">0</xsl:param>
  <!-- *******************************************************************
Template: DoIndex - used for INDEX_T and IND in constraints
  This template puts out
   - the opening INDEX element (with xmlns and version attributes)
   - BITMAP or UNIQUE elements (optional)
   - SCHEMA and NAME elements
  then calls one of
   - ClusterIndex
   - BitmapJoinIndex
   - TableIndex
Parameters:
 IndNode - INDEX_T node or IND node
 ConstraintIndex - 1 = INDEX SXML in constraint
******************************************************************** -->
  <xsl:element name="INDEX" namespace="http://xmlns.oracle.com/ku">
   <xsl:attribute name="version">1.0</xsl:attribute>
   <!-- BITMAP and UNIQUE not valid for cluster index -->
   <xsl:if test="$IndNode/BASE_OBJ/TYPE_NUM!=3">
    <xsl:choose>
     <xsl:when test="$IndNode/TYPE_NUM='2'">
      <xsl:element name="BITMAP"/>
     </xsl:when>
     <xsl:when test="($IndNode/PROPERTY mod 2)=1">
      <xsl:element name="UNIQUE"/>
     </xsl:when>
    </xsl:choose>
   </xsl:if>
   <!-- the SCHEMA_OBJ template is in kuscomm.xsl -->
   <xsl:apply-templates select="$IndNode/SCHEMA_OBJ"/>
   <!-- dispatch to appropriate template: cluster index,
      bitmap join index, or table index -->
   <xsl:choose>
    <xsl:when test="$IndNode/BASE_OBJ/TYPE_NUM=3">
     <xsl:element name="CLUSTER_INDEX">
      <xsl:call-template name="ClusterIndex">
       <xsl:with-param name="IndNode" select="$IndNode"/>
       <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
      </xsl:call-template>
     </xsl:element>
    </xsl:when>
    <xsl:when test="($IndNode/PROPERTY mod 2048)>=1024">
     <xsl:element name="BITMAP_JOIN_INDEX">
      <xsl:call-template name="BitmapJoinIndex">
       <xsl:with-param name="IndNode" select="$IndNode"/>
       <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
      </xsl:call-template>
     </xsl:element>
    </xsl:when>
    <xsl:otherwise>
     <xsl:element name="TABLE_INDEX">
      <xsl:call-template name="TableIndex">
       <xsl:with-param name="IndNode" select="$IndNode"/>
       <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
      </xsl:call-template>
     </xsl:element>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:if test="(string(ROWCNT) and not ($STATISTICS=0))">
    <xsl:element name="STATISTICS">
     <xsl:call-template name="CreIndexStats"/>
    </xsl:element>
   </xsl:if>
  </xsl:element>
 </xsl:template>
 <xsl:template name="CreIndexStats">
  <!-- *******************************************************************
Template: CreIndexStats - processing index stats
Current node: INDEX_T
  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="ROWCNT"/>
  </xsl:element>
  <xsl:element name="BLEVEL">
   <xsl:value-of select="BLEVEL"/>
  </xsl:element>
  <xsl:element name="LEAFCNT">
   <xsl:value-of select="LEAFCNT"/>
  </xsl:element>
  <xsl:element name="DISTKEY">
   <xsl:value-of select="DISTKEY"/>
  </xsl:element>
  <xsl:element name="LBLKKEY">
   <xsl:value-of select="LBLKKEY"/>
  </xsl:element>
  <xsl:element name="DBLKKEY">
   <xsl:value-of select="DBLKKEY"/>
  </xsl:element>
  <xsl:element name="CLUFAC">
   <xsl:value-of select="CLUFAC"/>
  </xsl:element>
 </xsl:template>
 <xsl:template name="ClusterIndex">
  <xsl:param name="IndNode" select="''"/>
  <xsl:param name="ConstraintIndex">0</xsl:param>
  <!-- *******************************************************************
Template: ClusterIndex
Parameters:
 IndNode - INDEX_T node or IND node
 ConstraintIndex - 1 = INDEX SXML in constraint
******************************************************************** -->
  <xsl:element name="ON_CLUSTER">
   <xsl:apply-templates select="$IndNode/BASE_OBJ"/>
  </xsl:element>
  <xsl:call-template name="IndexAttributes">
   <xsl:with-param name="IndNode" select="$IndNode"/>
   <xsl:with-param name="StorageParentNode" select="$IndNode"/>
   <xsl:with-param name="Partitioned">0</xsl:with-param>
   <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
  </xsl:call-template>
  <!-- Check if index is USABLE and/or if MONITORING is enabled -->
  <xsl:call-template name="CheckIndUsage">
   <xsl:with-param name="IndNode" select="$IndNode"/>
   <xsl:with-param name="IndFlags" select="$IndNode/FLAGS"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="TableIndex">
  <xsl:param name="IndNode" select="''"/>
  <xsl:param name="ConstraintIndex">0</xsl:param>
  <!-- *******************************************************************
Template: TableIndex
Parameters:
 IndNode - INDEX_T node or IND node
 ConstraintIndex - 1 = INDEX SXML in constraint
******************************************************************** -->
  <xsl:element name="ON_TABLE">
   <xsl:apply-templates select="$IndNode/BASE_OBJ"/>
  </xsl:element>
  <!-- column list
     Note: the col_list for domain index is not identical to the col_list
       for other types of indexes. Specifically domain index do not
       have column expressions while they do uniquely have FILTER_BY
       and ORDER_BY clauses.
  -->
  <xsl:element name="COL_LIST">
   <xsl:choose>
    <!-- domain index (type=9) -->
    <xsl:when test="TYPE_NUM=9">
     <xsl:call-template name="DoDomainColList">
      <xsl:with-param name="ColListNode" select="$IndNode/COL_LIST"/>
      <xsl:with-param name="IndProperty" select="PROPERTY"/>
     </xsl:call-template>
    </xsl:when>
    <!-- not domain index -->
    <xsl:otherwise>
     <xsl:call-template name="DoColList">
      <xsl:with-param name="ColListNode" select="$IndNode/COL_LIST"/>
      <xsl:with-param name="IndProperty" select="PROPERTY"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:element>
  <!-- process appropriate index attributes -->
  <xsl:choose>
   <xsl:when test="($IndNode/BASE_OBJ/FLAGS mod 4) >= 2">
    <!-- do index attributes for all indexes except those referencing temp tables -->
    <xsl:call-template name="TempTableIndexAttributes">
     <xsl:with-param name="IndNode" select="$IndNode"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <!-- index properties for all index except those referencing temp tables -->
    <xsl:call-template name="IndexProperties">
     <xsl:with-param name="IndNode" select="$IndNode"/>
     <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
  <!-- Check if the index is USABLE and/or if MONITORING is enabled -->
  <xsl:call-template name="CheckIndUsage">
   <xsl:with-param name="IndNode" select="$IndNode"/>
   <xsl:with-param name="IndFlags" select="$IndNode/FLAGS"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="DoDomainColList">
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="IndProperty" select="''"/>
  <!-- *******************************************************************
Template: DoDomainColList
Parameters:
 ColListNode
******************************************************************** -->
  <xsl:for-each select="$ColListNode/COL_LIST_ITEM[POS_NUM=1]">
   <!-- pos_num =1 is the domain index col -->
   <xsl:element name="COL_LIST_ITEM">
    <xsl:choose>
     <!-- check PROPERTY flags: functional index virt column is marked
     both virtual and hidden
                /* 0x0020 =      32 = hidden column                          */
            /* 0x00010000 =   65536 = virtual column                         */
     In such case we put out col$.default$ which contains the
     defining functional expression.
-->
     <!-- Note: colname references to XMLEXTRA.EXTRADATA are not valid
           for indexes. Therefore, we force the colname to OBJECT_VALUE.
     -->
     <xsl:when test="((COL/PROPERTY mod 64)>=32 
                 and (COL/PROPERTY mod 131072)>=65536)">
      <xsl:element name="NAME">
       <!--either DEFAULT_VAL or DEFAULT_VALC will be present but not both-->
       <xsl:value-of select="COL/DEFAULT_VAL"/>
       <xsl:value-of select="COL/DEFAULT_VALC"/>
      </xsl:element>
     </xsl:when>
     <xsl:when test="(COL/PROPERTY mod 64 >= 32) and
                      (COL/PROPERTY mod 256 >= 128) and
                      (contains(COL/ATTRNAME, 'EXTRADATA'))">
      <xsl:element name="NAME">OBJECT_VALUE</xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="ColName">
       <xsl:with-param name="ColNode" select="COL"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:element>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="DoColList">
  <xsl:param name="ColListNode" select="''"/>
  <xsl:param name="IndProperty" select="''"/>
  <!-- *******************************************************************
Template: DoColList
Parameters:
 ColListNode
******************************************************************** -->
  <xsl:for-each select="$ColListNode/COL_LIST_ITEM">
   <xsl:element name="COL_LIST_ITEM">
    <xsl:choose>
     <!-- check PROPERTY flags: functional index virt column is marked
         both virtual and hidden
                    /* 0x0020 =      32 = hidden column                      */
                /* 0x00010000 =   65536 = virtual column                     */
         In such case we put out col$.default$ which contains the
         defining functional expression.
         HOWEVER, if this bit
                /* 0x0008 =       8 = virtual column                         */
         is also set and these bits are clear:
                /* 0x0100 =     256 = system-generated column                */
                /* 0x0200 =     512 = rowinfo column of typed table/view     */
                /* 0x4000 =   16384 = dropped column                         */
         that means it is an XMLType virtual column, and we should use the
         column name.
     -->
     <xsl:when test="(COL/PROPERTY mod 16 >= 8) and
                      (COL/PROPERTY mod 64 >= 32) and
                      (COL/PROPERTY mod 131052 >= 65536) and
                      (256 > (COL/PROPERTY mod 512)) and
                      (512 > (COL/PROPERTY mod 1024)) and
                      (16384 > (COL/PROPERTY mod 32768))">
      <!-- xmltype virtual column: use column name -->
      <xsl:call-template name="ColName">
       <xsl:with-param name="ColNode" select="COL"/>
      </xsl:call-template>
     </xsl:when>
     <xsl:when test="((COL/PROPERTY mod 64)>=32 
                 and (COL/PROPERTY mod 131072)>=65536)">
      <!-- functional index -->
      <xsl:choose>
       <xsl:when test="$PARSE_EXPRESSIONS=1 and COL/COL_EXPR">
        <xsl:element name="COLUMN_EXPRESSION">
         <xsl:copy-of select="COL/COL_EXPR/*"/>
        </xsl:element>
       </xsl:when>
       <xsl:when test="ORG_COL_NAME">
        <xsl:element name="NAME">
         <xsl:value-of select="ORG_COL_NAME"/>
        </xsl:element>
       </xsl:when>
       <xsl:otherwise>
        <xsl:element name="NAME">
         <!--either DEFAULT_VAL or DEFAULT_VALC will be present but not both-->
         <xsl:value-of select="COL/DEFAULT_VAL"/>
         <xsl:value-of select="COL/DEFAULT_VALC"/>
        </xsl:element>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:when>
     <xsl:when test="(COL/PROPERTY mod 64 >= 32) and
                      (COL/PROPERTY mod 256 >= 128) and
                      (contains(COL/ATTRNAME, 'EXTRADATA'))">
      <xsl:element name="NAME">OBJECT_VALUE</xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="ColName">
       <xsl:with-param name="ColNode" select="COL"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
    <!-- DESCending order index is bit 0x20000 (131072) in col$.property -->
    <xsl:if test="(COL/PROPERTY mod 262144)>=131072">
     <xsl:element name="DESC"/>
    </xsl:if>
   </xsl:element>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="IndexProperties">
  <xsl:param name="IndNode" select="''"/>
  <xsl:param name="ConstraintIndex">0</xsl:param>
  <!-- *******************************************************************
Template: IndexProperties
Parameters:
 IndNode - INDEX_T node or IND node
 ConstraintIndex - 1 = INDEX SXML in constraint
******************************************************************** -->
  <!-- The default INDEXING option is FULL - only generate INDEXING 
       element if its PARTIAL.
   -->
  <xsl:if test="(FLAGS mod 16777216) >= 8388608">
   <xsl:element name="INDEXING">PARTIAL</xsl:element>
  </xsl:if>
  <xsl:choose>
   <!-- domain index -->
   <xsl:when test="$IndNode/TYPE_NUM=9">
    <xsl:element name="DOMAIN_INDEX_PROPERTIES">
     <xsl:call-template name="DomainIndex">
      <xsl:with-param name="IndNode" select="$IndNode"/>
     </xsl:call-template>
    </xsl:element>
   </xsl:when>
   <!-- partitioned index -->
   <xsl:when test="$IndNode/PART_OBJ">
    <!-- index attributes -->
    <xsl:call-template name="IndexAttributes">
     <xsl:with-param name="IndNode" select="$IndNode"/>
     <xsl:with-param name="StorageParentNode" select="$IndNode/PART_OBJ/PARTOBJ"/>
     <xsl:with-param name="Partitioned">1</xsl:with-param>
     <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
     <xsl:with-param name="DefaultBlocksize" select="$IndNode/BLOCKSIZE"/>
    </xsl:call-template>
    <xsl:if test="$PARTITIONING =1">
     <xsl:choose>
      <!-- local partitioning -->
      <xsl:when test="($IndNode/PART_OBJ/PARTOBJ/FLAGS mod 2)=1">
       <xsl:call-template name="LocalPartitionedIndex">
        <xsl:with-param name="IndNode" select="$IndNode"/>
       </xsl:call-template>
      </xsl:when>
      <!-- global partitioning -->
      <xsl:otherwise>
       <xsl:call-template name="GlobalPartitionedIndex">
        <xsl:with-param name="IndNode" select="$IndNode"/>
       </xsl:call-template>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:if>
   </xsl:when>
   <!-- non-partitioned index -->
   <xsl:otherwise>
    <xsl:call-template name="IndexAttributes">
     <xsl:with-param name="IndNode" select="$IndNode"/>
     <xsl:with-param name="StorageParentNode" select="$IndNode"/>
     <xsl:with-param name="Partitioned">0</xsl:with-param>
     <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="BitmapJoinIndex">
  <xsl:param name="IndNode" select="''"/>
  <xsl:param name="ConstraintIndex">0</xsl:param>
  <!-- *******************************************************************
Template: BitmapJoinIndex
Parameters:
 IndNode - INDEX_T node or IND node
 ConstraintIndex - 1 = INDEX SXML in constraint
******************************************************************** -->
  <xsl:element name="ON_TABLE">
   <xsl:apply-templates select="$IndNode/BASE_OBJ"/>
  </xsl:element>
  <!-- column list -->
  <xsl:element name="COL_LIST">
   <xsl:for-each select="$IndNode/COL_LIST/COL_LIST_ITEM">
    <xsl:element name="COL_LIST_ITEM">
     <xsl:call-template name="JijoinSchemaName">
      <xsl:with-param name="JijoinTabsNode" select="$IndNode/JIJOIN_TABS"/>
      <xsl:with-param name="TabObjNum" select="BO_NUM"/>
     </xsl:call-template>
     <xsl:element name="COL">
      <xsl:value-of select="COL/NAME"/>
     </xsl:element>
    </xsl:element>
   </xsl:for-each>
  </xsl:element>
  <!-- join table list -->
  <xsl:element name="JOIN_TABLE_LIST">
   <xsl:for-each select="$IndNode/JIJOIN_TABS/JIJOIN_TABS_ITEM">
    <xsl:element name="JOIN_TABLE_LIST_ITEM">
     <xsl:element name="SCHEMA">
      <xsl:value-of select="OWNER_NAME"/>
     </xsl:element>
     <xsl:element name="NAME">
      <xsl:value-of select="NAME"/>
     </xsl:element>
    </xsl:element>
   </xsl:for-each>
  </xsl:element>
  <!-- where list -->
  <xsl:element name="WHERE_LIST">
   <xsl:for-each select="$IndNode/JIJOIN/JIJOIN_ITEM">
    <xsl:element name="WHERE_LIST_ITEM">
     <xsl:element name="JOIN_LIST">
      <xsl:element name="JOIN_LIST_ITEM">
       <xsl:call-template name="JijoinSchemaName">
        <xsl:with-param name="JijoinTabsNode" select="$IndNode/JIJOIN_TABS"/>
        <xsl:with-param name="TabObjNum" select="TAB1OBJ_NUM"/>
       </xsl:call-template>
       <xsl:element name="COL">
        <xsl:value-of select="TAB1COL/NAME"/>
       </xsl:element>
      </xsl:element>
      <xsl:element name="JOIN_LIST_ITEM">
       <xsl:call-template name="JijoinSchemaName">
        <xsl:with-param name="JijoinTabsNode" select="$IndNode/JIJOIN_TABS"/>
        <xsl:with-param name="TabObjNum" select="TAB2OBJ_NUM"/>
       </xsl:call-template>
       <xsl:element name="COL">
        <xsl:value-of select="TAB2COL/NAME"/>
       </xsl:element>
      </xsl:element>
     </xsl:element>
    </xsl:element>
   </xsl:for-each>
  </xsl:element>
  <!-- index attributes -->
  <xsl:choose>
   <xsl:when test="$IndNode/PART_OBJ">
    <xsl:call-template name="IndexAttributes">
     <xsl:with-param name="IndNode" select="$IndNode"/>
     <xsl:with-param name="StorageParentNode" select="$IndNode/PART_OBJ/PARTOBJ"/>
     <xsl:with-param name="Partitioned">1</xsl:with-param>
     <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
     <xsl:with-param name="DefaultBlocksize" select="$IndNode/BLOCKSIZE"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="IndexAttributes">
     <xsl:with-param name="IndNode" select="$IndNode"/>
     <xsl:with-param name="StorageParentNode" select="$IndNode"/>
     <xsl:with-param name="Partitioned">0</xsl:with-param>
     <xsl:with-param name="ConstraintIndex" select="$ConstraintIndex"/>
     <xsl:with-param name="DefaultBlocksize" select="$IndNode/BLOCKSIZE"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
  <!-- local partitioned index -->
  <xsl:if test="(PART_OBJ) and ($PARTITIONING=1)">
   <xsl:call-template name="LocalPartitionedIndex">
    <xsl:with-param name="IndNode" select="$IndNode"/>
   </xsl:call-template>
  </xsl:if>
  <!-- Check if index is USABLE and/or if MONITORING is enabled -->
  <xsl:call-template name="CheckIndUsage">
   <xsl:with-param name="IndNode" select="$IndNode"/>
   <xsl:with-param name="IndFlags" select="$IndNode/FLAGS"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="JijoinSchemaName">
  <xsl:param name="JijoinTabsNode" select="''"/>
  <xsl:param name="TabObjNum" select="''"/>
  <!-- *******************************************************************
Template: JijoinSchemaName - This template emits SCHEMA and NAME
 for a column list item in a bitmap join index. The column list
 entry has the table object number (TabObjNum).  JIJOIN_TABS
 is a list of JIJOIN_TABS_ITEM entries, one for each table
 in the join index, with the table schema and name.
Parameters:
 JijoinTabsNode - JIJOIN_TABS node
 TabObjNum      - value of TABOBJ_NUM (object number of table)
******************************************************************** -->
  <xsl:element name="SCHEMA">
   <xsl:value-of select="$JijoinTabsNode/JIJOIN_TABS_ITEM[TABOBJ_NUM=$TabObjNum]/OWNER_NAME"/>
  </xsl:element>
  <xsl:element name="NAME">
   <xsl:value-of select="$JijoinTabsNode/JIJOIN_TABS_ITEM[TABOBJ_NUM=$TabObjNum]/NAME"/>
  </xsl:element>
 </xsl:template>
 <xsl:template name="IndexAttributes">
  <xsl:param name="IndNode" select="''"/>
  <xsl:param name="StorageParentNode" select="''"/>
  <xsl:param name="Partitioned" select="''"/>
  <xsl:param name="ConstraintIndex">0</xsl:param>
  <xsl:param name="DefaultBlocksize" select="''"/>
  <!-- *******************************************************************
Template: IndexAttributes
Parameters:
  IndNode - INDEX_T node
  StorageParentNode - Parent node of STORAGE, TS_NAME, PCT_FREE, etc.
  Partitioned - 0 = non-partitioned, non-0 = partitioned
  ConstraintIndex - 1 = INDEX SXML in constraint
  DefaultBlocksize - DefaultBlocksize for PhysicalAttributes
******************************************************************** -->
  <xsl:if test="not ($PHYSICAL_PROPERTIES=0) and not ($SEGMENT_ATTRIBUTES=0)">
   <xsl:element name="INDEX_ATTRIBUTES">
    <xsl:call-template name="PhysicalAttributes">
     <xsl:with-param name="ParentNode" select="$StorageParentNode"/>
     <xsl:with-param name="Partitioned" select="$Partitioned"/>
     <xsl:with-param name="ObjType">INDEX</xsl:with-param>
     <xsl:with-param name="DefaultBlocksize" select="$DefaultBlocksize"/>
    </xsl:call-template>
    <!-- Generates tablespace clause when index is not fake -->
    <xsl:if test="not((FLAGS mod 8192)>=4096)">
     <xsl:call-template name="Tablespace">
      <xsl:with-param name="ParentNode" select="$StorageParentNode"/>
     </xsl:call-template>
    </xsl:if>
    <!-- logging clause (non-partitioned indexes have a different
       encoding for logging than tables, so we have to do special
       processing) -->
    <xsl:choose>
     <xsl:when test="$Partitioned=0">
      <xsl:element name="LOGGING">
       <xsl:choose>
        <xsl:when test="($StorageParentNode/FLAGS mod 8)>=4">N</xsl:when>
        <xsl:otherwise>Y</xsl:otherwise>
       </xsl:choose>
      </xsl:element>
     </xsl:when>
     <!-- for partitioned indexes we can use common code -->
     <xsl:otherwise>
      <xsl:call-template name="LoggingClause">
       <xsl:with-param name="Partitioned" select="$Partitioned"/>
       <xsl:with-param name="FlagsNode" select="''"/>
       <xsl:with-param name="DefloggingNode" select="$StorageParentNode/DEFLOGGING"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
    <!-- key compression:
       ind$.flags
           key compression enabled : 0x20
       ind$.spare2 (which we call NUMKEYCOLS)
           number of key columns in compressed prefix
    -->
    <xsl:if test="($IndNode/FLAGS mod 64)>=32
             and $IndNode/NUMKEYCOLS">
     <xsl:element name="KEYCOMPRESS">
      <xsl:value-of select="$IndNode/NUMKEYCOLS"/>
     </xsl:element>
    </xsl:if>
    <!-- REVERSE -->
    <xsl:if test="($IndNode/PROPERTY mod 8)>=4">
     <xsl:element name="REVERSE"/>
    </xsl:if>
    <!-- INVISIBLE -->
    <xsl:if test="$VERSION >=1100000000 and ($IndNode/FLAGS mod 4194304)>=2097152">
     <xsl:element name="INVISIBLE"/>
    </xsl:if>
    <!-- parallel clause -->
    <xsl:if test="$ConstraintIndex=0">
     <xsl:call-template name="ParallelClause">
      <xsl:with-param name="ParentNode" select="$IndNode"/>
     </xsl:call-template>
    </xsl:if>
    <!-- Check if it is nosegment index -->
    <xsl:if test="(FLAGS mod 8192)>=4096">
     <xsl:element name="NOSEGMENT"/>
    </xsl:if>
   </xsl:element>
  </xsl:if>
 </xsl:template>
 <xsl:template name="TempTableIndexAttributes">
  <xsl:param name="IndNode" select="''"/>
  <!-- *******************************************************************
Template: TempTableIndexAttributes
Parameters:
  IndNode - INDEX_T node
******************************************************************** -->
  <!-- key compression:
       ind$.flags
           key compression enabled : 0x20
       ind$.spare2 (which we call NUMKEYCOLS)
           number of key columns in compressed prefix
    -->
  <xsl:element name="INDEX_ATTRIBUTES">
   <xsl:if test="($IndNode/FLAGS mod 64)>=32
             and $IndNode/NUMKEYCOLS">
    <xsl:element name="KEYCOMPRESS">
     <xsl:value-of select="$IndNode/NUMKEYCOLS"/>
    </xsl:element>
   </xsl:if>
   <!-- REVERSE -->
   <xsl:if test="($IndNode/PROPERTY mod 8)>=4">
    <xsl:element name="REVERSE"/>
   </xsl:if>
   <!-- INVISIBLE -->
   <xsl:if test="$VERSION >=1100000000 and ($IndNode/FLAGS mod 4194304)>=2097152">
    <xsl:element name="INVISIBLE"/>
   </xsl:if>
  </xsl:element>
 </xsl:template>
 <xsl:template name="DomainIndex">
  <xsl:param name="IndNode" select="''"/>
  <!-- *******************************************************************
Template: DomainIndex
Parameters:
  IndNode - INDEX_T node
******************************************************************** -->
  <xsl:element name="INDEXTYPE">
   <xsl:element name="SCHEMA">
    <xsl:value-of select="$IndNode/INDTYPE_OWNER"/>
   </xsl:element>
   <xsl:element name="NAME">
    <xsl:value-of select="$IndNode/INDTYPE_NAME"/>
   </xsl:element>
  </xsl:element>
  <!-- Invisible if bit 0x200000 in FLAGS=1 -->
  <xsl:if test="$VERSION >=1100000000 and ($IndNode/FLAGS mod 4194304)>=2097152">
   <xsl:element name="INVISIBLE"/>
  </xsl:if>
  <!-- FILTER BY - generate FILTER_BY elements if applicable -->
  <!-- Invisible if bit 0x200000 in FLAGS=1 -->
  <xsl:if test="$VERSION >=1100000000 and  
                    (FLAGS mod 4194304) >= 2097152">INVISIBLE </xsl:if>
  <xsl:variable name="FilterNodes" select="COL_LIST/COL_LIST_ITEM[(FLAGS mod 8)>=4]"/>
  <xsl:if test="count($FilterNodes) > 0">
   <xsl:element name="FILTER_BY_LIST">
    <xsl:for-each select="$FilterNodes">
     <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:if>
  <!-- ORDER BY - generate ORDER_BY elements if applicable -->
  <xsl:variable name="OrderNodes" select="COL_LIST/COL_LIST_ITEM[(FLAGS mod 16)>=8]"/>
  <xsl:if test="count($OrderNodes) > 0">
   <xsl:element name="ORDER_BY_LIST">
    <xsl:for-each select="$OrderNodes">
     <xsl:sort select="SPARE3" data-type="number"/>
     <xsl:element name="COL_LIST_ITEM">
      <xsl:call-template name="ColName">
       <xsl:with-param name="ColNode" select="COL"/>
      </xsl:call-template>
      <xsl:if test="(FLAGS mod 4)>=2">
       <xsl:element name="DESC"/>
      </xsl:if>
     </xsl:element>
    </xsl:for-each>
   </xsl:element>
  </xsl:if>
  <!-- parallel clause -->
  <xsl:call-template name="ParallelClause">
   <xsl:with-param name="ParentNode" select="$IndNode"/>
  </xsl:call-template>
  <!-- parameters -->
  <xsl:choose>
   <!-- partitioned -->
   <xsl:when test="$IndNode/PART_OBJ">
    <xsl:if test="$IndNode/PART_OBJ/PARTOBJ/DEFPARAMETERS">
     <xsl:element name="PARAMETERS">
      <xsl:value-of select="$IndNode/PART_OBJ/PARTOBJ/DEFPARAMETERS"/>
     </xsl:element>
    </xsl:if>
    <xsl:element name="LOCAL_PARTITIONING">
     <xsl:element name="PARTITION_LIST">
      <xsl:for-each select="$IndNode/PART_OBJ/PART_LIST/PART_LIST_ITEM">
       <xsl:element name="PARTITION_LIST_ITEM">
        <xsl:element name="NAME">
         <xsl:value-of select="SCHEMA_OBJ/SUBNAME"/>
        </xsl:element>
        <xsl:if test="PARAMETERS">
         <xsl:element name="PARAMETERS">
          <xsl:value-of select="PARAMETERS"/>
         </xsl:element>
        </xsl:if>
       </xsl:element>
      </xsl:for-each>
     </xsl:element>
    </xsl:element>
   </xsl:when>
   <!-- non-partitioned -->
   <xsl:when test="$IndNode/SPARE4">
    <xsl:element name="PARAMETERS">
     <xsl:value-of select="$IndNode/SPARE4"/>
    </xsl:element>
   </xsl:when>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="LocalPartitionedIndex">
  <xsl:param name="IndNode" select="''"/>
  <!-- *******************************************************************
Template: LocalPartitionedIndex
Parameters:
  IndNode - INDEX_T node
******************************************************************** -->
  <xsl:variable name="PartListNode" select="$IndNode/PART_OBJ/PART_LIST | $IndNode/PART_OBJ/COMPART_LIST"/>
  <xsl:variable name="PartitionType">
   <xsl:choose>
    <xsl:when test="$IndNode/PART_OBJ/PARTOBJ/PARTTYPE=1">RANGE</xsl:when>
    <xsl:when test="$IndNode/PART_OBJ/PARTOBJ/PARTTYPE=2">HASH</xsl:when>
    <xsl:when test="$IndNode/PART_OBJ/PARTOBJ/PARTTYPE=3">SYSTEM</xsl:when>
    <xsl:when test="$IndNode/PART_OBJ/PARTOBJ/PARTTYPE=4">LIST</xsl:when>
   </xsl:choose>
  </xsl:variable>
  <!--  BUG 4544267: In a compressed partitioned index           -->
  <!--   some partitions can be NOCOMPRESS. We pass a parameter  -->
  <!--   to indicate that compression is enabled.                -->
  <xsl:variable name="PartCompress" select="(($IndNode/FLAGS mod 64)>=32) 
                              and $IndNode/NUMKEYCOLS 
                              and ($IndNode/NUMKEYCOLS > 0)"/>
  <xsl:element name="LOCAL_PARTITIONING">
   <xsl:call-template name="IndexPartitionList">
    <xsl:with-param name="PartListNode" select="$PartListNode"/>
    <xsl:with-param name="PartitionType" select="$PartitionType"/>
    <xsl:with-param name="TabBlocksize" select="$IndNode/BLOCKSIZE"/>
    <xsl:with-param name="Local">1</xsl:with-param>
    <xsl:with-param name="PartCompress" select="$PartCompress"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="GlobalPartitionedIndex">
  <xsl:param name="IndNode" select="''"/>
  <!-- *******************************************************************
Template: GlobalPartitionedIndex
Parameters:
  IndNode - INDEX_T node
******************************************************************** -->
  <xsl:element name="GLOBAL_PARTITIONING">
   <xsl:choose>
    <!-- range partitioning-->
    <xsl:when test="$IndNode/PART_OBJ/PARTOBJ/PARTTYPE=1">
     <xsl:call-template name="GlobalRangePartitionedIndex">
      <xsl:with-param name="IndNode" select="$IndNode"/>
     </xsl:call-template>
    </xsl:when>
    <!-- hash partitioning-->
    <xsl:when test="$IndNode/PART_OBJ/PARTOBJ/PARTTYPE=2">
     <xsl:call-template name="GlobalHashPartitionedIndex">
      <xsl:with-param name="IndNode" select="$IndNode"/>
     </xsl:call-template>
    </xsl:when>
   </xsl:choose>
  </xsl:element>
 </xsl:template>
 <xsl:template name="GlobalRangePartitionedIndex">
  <xsl:param name="IndNode" select="''"/>
  <!-- *******************************************************************
Template: GlobalRangePartitionedIndex
Parameters:
  IndNode - INDEX_T node
******************************************************************** -->
  <xsl:element name="RANGE_PARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$IndNode/PART_OBJ/PARTCOLS"/>
   </xsl:call-template>
   <xsl:call-template name="IndexPartitionList">
    <xsl:with-param name="PartListNode" select="$IndNode/PART_OBJ/PART_LIST"/>
    <xsl:with-param name="PartitionType">RANGE</xsl:with-param>
    <xsl:with-param name="TabBlocksize" select="$IndNode/BLOCKSIZE"/>
    <!--  BUG 4544267: In a compressed partitioned index           -->
    <!--   some partitions can be NOCOMPRESS. We pass a parameter  -->
    <!--   to indicate that compression is enabled.                -->
    <xsl:with-param name="PartCompress" select="(($IndNode/FLAGS mod 64)>=32) 
              and $IndNode/NUMKEYCOLS 
              and ($IndNode/NUMKEYCOLS > 0)"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="GlobalHashPartitionedIndex">
  <xsl:param name="IndNode" select="''"/>
  <!-- *******************************************************************
Template: GlobalHashPartitionedIndex
Parameters:
  IndNode - INDEX_T node
******************************************************************** -->
  <xsl:element name="HASH_PARTITIONING">
   <xsl:call-template name="DoPartColList">
    <xsl:with-param name="PartcolsNode" select="$IndNode/PART_OBJ/PARTCOLS"/>
   </xsl:call-template>
   <xsl:call-template name="IndexPartitionList">
    <xsl:with-param name="PartListNode" select="$IndNode/PART_OBJ/PART_LIST"/>
    <xsl:with-param name="PartitionType">HASH</xsl:with-param>
    <xsl:with-param name="TabBlocksize" select="$IndNode/BLOCKSIZE"/>
   </xsl:call-template>
  </xsl:element>
 </xsl:template>
 <xsl:template name="CheckIndUsage">
  <xsl:param name="IndNode" select="''"/>
  <xsl:param name="IndFlags" select="''"/>
  <!-- *******************************************************************
Template: CheckIndUsage - used for setting UNUSABLE and/or MONITORING_USAGE
Parameters:
 IndNode - INDEX_T node or IND node
 IndFlags - <1> = UNUSABLE
            <65536> = MONITORING enabled
******************************************************************** -->
  <xsl:if test="($IndFlags mod 2)=1">
   <xsl:element name="UNUSABLE"/>
  </xsl:if>
  <xsl:if test="($IndFlags mod 131072)>=65536">
   <xsl:element name="MONITORING_USAGE"/>
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO