User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the XML, XSLT and XPATH section within the Software Development category of DaniWeb, a massive community of 374,165 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,249 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our XML, XSLT and XPATH advertiser:
Views: 1820 | Replies: 12
Reply
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

XSLT and DB2 data

  #1  
Dec 11th, 2007
I want to publish my DB2 data to PDF file using XSLT. Has anyone tried this?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XSLT and DB2 data

  #2  
Dec 12th, 2007
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
Reply With Quote  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XSLT and DB2 data

  #3  
Dec 26th, 2007
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?
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XSLT and DB2 data

  #4  
Dec 27th, 2007
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.
Reply With Quote  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XSLT and DB2 data

  #5  
Dec 28th, 2007
How do I create an HTML document using XSLT stylesheet?
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XSLT and DB2 data

  #6  
Jan 2nd, 2008
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.
Reply With Quote  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XSLT and DB2 data

  #7  
Jan 21st, 2008
How are XML documents transformed and can DB2 9 XML extenders be used for this?
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XSLT and DB2 data

  #8  
Jan 24th, 2008
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.
Reply With Quote  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XSLT and DB2 data

  #9  
Jan 30th, 2008
I want to use XML extenders of DB2. Can anyone explain the syntax of XSL function XSLTransformToFile?
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XSLT and DB2 data

  #10  
Feb 6th, 2008
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)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb XML, XSLT and XPATH Marketplace
Thread Tools Display Modes

Other Threads in the XML, XSLT and XPATH Forum

All times are GMT -4. The time now is 4:08 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC