DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   XML, XSLT and XPATH (http://www.daniweb.com/forums/forum134.html)
-   -   XSLT and DB2 data (http://www.daniweb.com/forums/thread100611.html)

v.godhe Dec 11th, 2007 2:32 am
XSLT and DB2 data
 
I want to publish my DB2 data to PDF file using XSLT. Has anyone tried this?

dilasing Dec 12th, 2007 12:39 am
Re: XSLT and DB2 data
 
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

v.godhe Dec 26th, 2007 12:46 am
Re: XSLT and DB2 data
 
I want to translate XML document using XSL transformation. Does DB2 V9 support xsltransform XSLT functions? If DB2 V9 does not support this what are other XSLT functions supported by DB2 V9?

dilasing Dec 27th, 2007 12:23 am
Re: XSLT and DB2 data
 
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.

v.godhe Dec 28th, 2007 3:21 am
Re: XSLT and DB2 data
 
How do I create an HTML document using XSLT stylesheet?

dilasing Jan 2nd, 2008 1:42 am
Re: XSLT and DB2 data
 
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.

v.godhe Jan 21st, 2008 2:29 am
Re: XSLT and DB2 data
 
How are XML documents transformed and can DB2 9 XML extenders be used for this?

dilasing Jan 24th, 2008 5:19 am
Re: XSLT and DB2 data
 
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.

v.godhe Jan 30th, 2008 3:49 am
Re: XSLT and DB2 data
 
I want to use XML extenders of DB2. Can anyone explain the syntax of XSL function XSLTransformToFile?

dilasing Feb 6th, 2008 3:39 am
Re: XSLT and DB2 data
 
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)


All times are GMT -4. The time now is 4:02 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC