Performing xsl transformations on the server – Adobe Dreamweaver CS3 User Manual

Page 434

Advertising
background image

DREAMWEAVER CS3

User Guide

427

The following topics provide guidelines for helping you determine the appropriate previewing methods, based on
your needs.

Previewing pages for server-side transformations

In the case of server-side transformations, the content the site visitor ultimately sees is transformed by your appli-
cation server. When building XSLT and dynamic pages for use with server-side transformations, it is always
preferable to preview the dynamic page that contains the XSLT fragment instead of the XSLT fragment itself. In the
former scenario, you make use of the application server, which ensures that your preview is consistent with what your
site visitors will see when they visit your page. In the latter scenario, Dreamweaver performs the transformation, and
could provide slightly inconsistent results. You can use Dreamweaver to preview your XSLT fragment while you are
building it, but you’ll be able to see the most accurate results of the data rendering if you use the application server
to preview your dynamic page after you’ve inserted the XSLT fragment.

Previewing pages for client-side transformations

In the case of client-side transformations, the content the site visitor ultimately sees is transformed by a browser. You
accomplish this by adding a link from the XML file to the XSLT page. If you open the XML file in Dreamweaver and
preview it in a browser, you force the browser to load the XML file and perform the transformation. This provides
you with the same experience as that of your site visitor.

Using this approach, however, makes it more difficult to debug your page because the browser transforms the XML
and generates the HTML internally. If you select the browser’s View Source option to debug the generated HTML,
you will only see the original XML that the browser received, not the full HTML (tags, styles, and so forth) respon-
sible for the rendering of the page. To see the full HTML when viewing source code, you must preview the XSLT page
in a browser instead.

Previewing entire XSLT pages and XSLT fragments

When creating entire XSLT pages and XSLT fragments, you’ll want to preview your work to make sure that your data
is being displayed correctly. If you use Preview in Browser to display an entire XSLT page or an XSLT fragment,
Dreamweaver performs the transformation using a built-in transformation engine. This method gives you quick
results, and makes it easier for you to incrementally build and debug your page. It also provides a way for you to view
the full HTML (tags, styles, and so forth) by selecting the View Source option in the browser.

Note: This previewing method is commonly used when you begin building XSLT pages, regardless of whether you use
the client or the server to transform your data.

Performing XSL transformations on the server

Workflow for performing server-side XSL transformations

You can perform server-side XSL transformations on the server. Read about server-side and client-side XSL trans-
formations and about using XML and XSL with web pages before building pages that display XML data.

Type of page previewed in browser

Data transformation performed by

Dynamic page containing XSLT fragment

Application server

XSLT fragment or entire XSLT page

Dreamweaver

XML file with link to entire XSLT page

Browser

September 4, 2007

Advertising