| | |
XSLT and DB2 data
![]() |
•
•
Join Date: Oct 2007
Posts: 76
Reputation:
Solved Threads: 0
This process requires three steps:
i)First, you create an XML file using DB2 built-in XML functions.
ii)You transform that file using XSL-FO (eXtensible Stylesheet Language - Formatting Objects). Apache xlane might be useful for you.
iii)Using an XSL-FO renderer, you transform the file to PDF format. Use apache FOP framework to create PDF files with XLST.
You can read more at
http://www.ibm.com/developerworks/db...lima/#section2
i)First, you create an XML file using DB2 built-in XML functions.
ii)You transform that file using XSL-FO (eXtensible Stylesheet Language - Formatting Objects). Apache xlane might be useful for you.
iii)Using an XSL-FO renderer, you transform the file to PDF format. Use apache FOP framework to create PDF files with XLST.
You can read more at
http://www.ibm.com/developerworks/db...lima/#section2
•
•
Join Date: Oct 2007
Posts: 76
Reputation:
Solved Threads: 0
DB2 9 does not support XSLT supported functions. However, DB2 V9.5 provides the functionality of processing XML document using XSL transformation within the database itself. The XML document stored in the database can be transformed to the HTML format by applying XLST stylesheet. To do this, DB2 V9.5 introduces the xsltransform function. It also supports stylesheets which use parameters. The xsltransform function can apply the XSLT stylesheet stored in a database table column as an XML document on an XML document. This gives the user the flexibility to retrieve a transformed XML document from the database and directly represent it on the web.
DB2 V9 supports XSLTransformToClob and XSLTransformToFile XSLT function.
XSLTransformToClob() reads an XML document as CLOB locator and a stylesheet as CLOB or from a file, and returns the document as CLOB.
XSLTransformToFile() Transforms the incoming XML document with the stylesheet and the XSLT parameter document. The transformed XML document is written into a file. When a directory and a suffix are passed as parameters, this UDF creates a file with the specified suffix in the specified directory.
DB2 V9 supports XSLTransformToClob and XSLTransformToFile XSLT function.
XSLTransformToClob() reads an XML document as CLOB locator and a stylesheet as CLOB or from a file, and returns the document as CLOB.
XSLTransformToFile() Transforms the incoming XML document with the stylesheet and the XSLT parameter document. The transformed XML document is written into a file. When a directory and a suffix are passed as parameters, this UDF creates a file with the specified suffix in the specified directory.
•
•
Join Date: Oct 2007
Posts: 76
Reputation:
Solved Threads: 0
You can create your HTML file by using the XSLTransformToFile or the XSLTransformToClob UDFs. The former returns the HTML document in a file while the latter returns it as a CLOB
To create your HTML document as a file, use the following syntax:
SELECT XSLTransformToFile(CAST(doc AS CLOB(4k)),
'dxx_install\samples\extenders\db2xml\xslt\getstart.xsl',
0, 'html\getstart.html') FROM RESULT_TAB
where dxx_install is the directory where you installed DB2 XML Extender.
To create your HTML document as a file, use the following syntax:
SELECT XSLTransformToFile(CAST(doc AS CLOB(4k)),
'dxx_install\samples\extenders\db2xml\xslt\getstart.xsl',
0, 'html\getstart.html') FROM RESULT_TAB
where dxx_install is the directory where you installed DB2 XML Extender.
•
•
Join Date: Oct 2007
Posts: 76
Reputation:
Solved Threads: 0
DB2 XML extenders provide an XSLT UDF to transform XML documents inside the database.
The two XSL UDFs defined in DB2 XML Extenders are XSLTransformToClob() and XSLTransformToFile().
SELECT XSLTransformToClob( info, /temp/xslfilename.xsl) FROM xslcustomers
You need to enable the database for XML extenders in order to use the XSLT UDFs because DB2 Viper has the XSL UDF as a part of the XML extender support, there is not any built-in function for XSL transformation.
Since XQuery has a lot of overlapping functionality with XSL, you can use XQuery in conjunction with the SQL/XML functions to transform and publish XML documents.
The two XSL UDFs defined in DB2 XML Extenders are XSLTransformToClob() and XSLTransformToFile().
SELECT XSLTransformToClob( info, /temp/xslfilename.xsl) FROM xslcustomers
You need to enable the database for XML extenders in order to use the XSLT UDFs because DB2 Viper has the XSL UDF as a part of the XML extender support, there is not any built-in function for XSL transformation.
Since XQuery has a lot of overlapping functionality with XSL, you can use XQuery in conjunction with the SQL/XML functions to transform and publish XML documents.
•
•
Join Date: Oct 2007
Posts: 76
Reputation:
Solved Threads: 0
Syntax of XSLTransformToFile:
XSLTransformToFile (XMLobj , stylesheet , param , validate , filename, dir , suffix)
i) XMLobj -> The XML document (CLOB) or (CAST(doc AS CLOB(4k)))
ii) stylesheet -> The style sheet (CLOB), The location and name of the stylesheet input file(VARCHAR)
iii) param -> The XSLT parameter document (CLOB), The location and name of the XSLT parameter file(VARCHAR)
iv) validate -> Enable (1) or disable (0) validation of the XMLobj(INTEGER)
v) filename -> The name of the output file(VARCHAR)
vi) dir -> The directory of the output file(VARCHAR)
vii) suffix -> The suffix of the output file(VARCHAR)
XSLTransformToFile (XMLobj , stylesheet , param , validate , filename, dir , suffix)
i) XMLobj -> The XML document (CLOB) or (CAST(doc AS CLOB(4k)))
ii) stylesheet -> The style sheet (CLOB), The location and name of the stylesheet input file(VARCHAR)
iii) param -> The XSLT parameter document (CLOB), The location and name of the XSLT parameter file(VARCHAR)
iv) validate -> Enable (1) or disable (0) validation of the XMLobj(INTEGER)
v) filename -> The name of the output file(VARCHAR)
vi) dir -> The directory of the output file(VARCHAR)
vii) suffix -> The suffix of the output file(VARCHAR)
![]() |
Other Threads in the XML, XSLT and XPATH Forum
- Previous Thread: SQL/XML Query
- Next Thread: different minOccurs for different operations?
| Thread Tools | Search this Thread |
api blogger blogging code delete development dynamiccreationofnvariablesinxslt error firstthreecharacterofastringrequired flipbook gdata google html include java link linspire linux microsoft news node openoffice overwrite precedence programming rss standards swf template transform variable w3c web xml xmlnotloading xmlonserver xsl xslt





