Using Stylesheets

Teradata Vantageā„¢ XML Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1140-162K

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;