DREAMWEAVER CS3
User Guide
436
For example, you might want to create an XSLT fragment for insertion in a dynamic page and format the fragment
using the same external style sheet as the dynamic page. If you attach the same style sheet to the fragment, the
resulting HTML page contains a duplicate link to the style sheet (one in the
<head>
section of the dynamic page, and
another in the
<body>
section of the page, where the content of the XSLT fragment appears). Instead of this
approach, you should use Design-time style sheets to reference the external style sheet.
When formatting the content of XSLT fragments, use the following workflow:
•
First, attach an external style sheet to the dynamic page. (This is a best practice for applying styles to the content
of any web page).
•
Next, attach the same external style sheet to the XSLT fragment as a Design-time style sheet. As the name implies,
Design-time style sheets only work in the Dreamweaver Design view.
After you have completed the two previous steps, you can create new styles in your XSLT fragment using the same
style sheet that you’ve attached to your dynamic page. The HTML output will be cleaner (because the reference to
the style sheet is only valid while working in Dreamweaver), and the fragment will still display the appropriate styles
in Design view. Additionally, all of your styles will be applied to both the fragment and the dynamic page when you
view the dynamic page in Design view, or preview the dynamic page in a browser.
Note:
If you preview the XSLT fragment in a browser, the browser does not display the styles. Instead you should preview
the dynamic page in the browser to see the XSLT fragment within the context of the dynamic page.
For more information on using CSS to format XSLT fragments, see
www.adobe.com/go/dw_xsl_styles
.
See also
“Use Design-Time style sheets” on page 143
Use parameters with XSL transformations
You can define parameters for your XSL transformation when adding the XSL Transformation server behavior to a
web page. A parameter controls how XML data is processed and displayed. For example, you might use a parameter
to identify and list a specific article from a news feed. When the page loads in a browser, only the article you specified
with the parameter appears.
Add an XSLT parameter to an XSL transformation
1
Open the XSL Transformation dialog box. You can do this by double-clicking an XSL Transformation server
behavior in the Server Behaviors panel (Window > Server Behaviors), or by adding a new XSL Transformation server
behavior.
September 4, 2007