开发者

Can we use values fetched from database table in XSLT?

开发者 https://www.devze.com 2023-01-22 13:29 出处:网络
I h开发者_JS百科ave a database with me consisting of certain tables. I have written a query to fetch some fields from a table and stored those fetched values in some variables. Now, I am looking for a

I h开发者_JS百科ave a database with me consisting of certain tables. I have written a query to fetch some fields from a table and stored those fetched values in some variables. Now, I am looking for a way which will allow to assign values fetched from database to the XSL variables. I am trying to generate a HTML page using fetched values.

Does anyone knows about how to achieve it?

Thanks in advance for any kind of help.

Regards, Vijay


Hi @Vijay,

XSLT (Extensible Stylesheet Language Transformations) is an XML stylesheet which in simple terms means that it's used to fetch data from an XML file.

You'll need to generate an XML file/string with the results from your database and then use XSLT to query the XML file.

Umbraco is an open-source CMS system which does exactly that. On every content publish, it generates an XML file with the most up-to-date data and then XSLT is used to generate HTML pages from that data.

Technically speaking, you could pull your database tables into a DataSet and then you can create an XML file from it which you can run your XSLT against.

This post explains how to do exactly that.

Have a read there and come back with any questions you may have.


The W3c soecifications for XSLT 1.0 and XSLT 2.0 do not provide functionality for performing RDBMS operations.

Some processors have extensions to do this.

For example Saxon has the following extension elements: sql:connect, sql:query, sql:insert, sql:column, sql:update, sql:delete, and sql:close

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号