•
•
•
•
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
![]() |
•
•
Join Date: Oct 2007
Posts: 76
Reputation:
Rep Power: 1
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:
Rep Power: 1
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:
Rep Power: 1
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:
Rep Power: 1
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:
Rep Power: 1
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)
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb XML, XSLT and XPATH Marketplace
•
•
•
•
access api asp blogger blogging classification code combo daniweb data data protection data transfer database development dom drive dropdownlist feed forensics fun gdata google hard hardware hitachi hp html information it linspire linux module net news privacy programming reader reuse rss security standards storage terabyte tutorials and more w3c weather web wikipedia xml xoap
- Previous Thread: SQL/XML Query
- Next Thread: different minOccurs for different operations?


Linear Mode