XSLT Shredding Mapping Definition | XML Data Type | Teradata Vantage - XSLT Shredding Mapping Definition - Analytics Database - Teradata Vantage

XML Data Type

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
tkc1628112506748.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
dgs1472251600184
lifecycle
latest
Product Category
Teradata Vantageā„¢

XSLT-based shredding is based on a mapping defined by XSLT stylesheet documents. The stylesheet defines how different parts of the XML document map to columns in target tables in a relational database. Shredding procedures interpret the stylesheet mappings as instructions on what data items to extract from the input XML documents and how to use those data items in updating the target tables.

Example XSLT Stylesheet

The following shows the syntax of the stylesheet mapping.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
 <Transaction>
  <OPERATION>                 ///Insert/Update/Delete/Upsert
   <Table>
    <TABLE NAME>             ///Table name in which to store the shredded values
     <xsl:for-each select="PATH">     ///Sub-tree path to iterate the shredding
      <Row>
       <xsl:copy-of select="ELEMENT PATH"/> ///ELEMENT PATH in XML sub tree
                           OR
       <COLUMN><xsl:value-of select=" ELEMENT PATH "/></COLUMN> 
                                     ///COLUMN is a column name in target table
      </Row>
     </xsl:for-each>
    </TABLE NAME >
   </Table>
  </OPERATION>
 </Transaction>
</xsl:template>
</xsl:stylesheet>