Using Stylesheets | XML Data Type | Teradata Vantage - 17.10 - Using Stylesheets - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - XML Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1140-171K
Language
English (United States)

The XSLTTRANSFORM method accepts a stylesheet as an argument along with a parameter map. For XSLT stylesheets that are composed of a single stylesheet document (the stylesheet document does not include another stylesheet document), you can pass the stylesheet document as an XML type value to the method. For XSLT stylesheets that are made up of more than one document, you must pass the consolidated stylesheet document as an XML type value to the method.

You can store the stylesheet or consolidated stylesheet document in a table and use it in a query that performs XSLT transformation through a join or subquery as follows:

SELECT x.xmlcol.xslttransform(s.stylesheetcontent, '')
FROM xmldata x, styletab s
WHERE s.stylesheetid = 'myAppStylesheet.xslt';

If you want to perform multiple transformations per row, you can use subqueries of the following form:

SELECT x.xmlcol1.xslttransform(s1.stylesheetcontent, ''),
   x.xmlcol2.xslttransform(s2.stylesheetcontent, '')
FROM xmldata x,
   (select st.stylesheetcontent
    from styletab st
    where st.stylesheetid = 'myFirstStylesheet.xslt') s1,
   (select st.stylesheetcontent
    from styletab st
    where st.stylesheetid = 'mySecondStylesheet.xslt') s2;