Wednesday, January 28, 2009

at 9:32 AM Posted by Visuals India 0 comments

Displaying database records involves retrieving information stored in a database or other source of content, and rendering that information to a web page. Macromedia Dreamweaver 8 provides many methods of displaying dynamic content, and provides several built-in server behaviors that let you both enhance the presentation of dynamic content, and allow users to more easily search through and navigate information returned from a database.

This chapter contains the following sections:

About displaying database records

Using predefined data formats

Creating recordset navigation links

Showing and hiding regions based on recordset results

Displaying multiple recordset results

Creating a table with a Repeat Region server behavior

Creating a record counter

at 9:31 AM Posted by Visuals India 0 comments

Databases and other sources of dynamic content provide you with more power and flexibility in searching, sorting, and viewing large stores of information. Using a database to store content for web sites makes sense when you need to store large amounts of information, and then retrieve and display that information in a meaningful way. Dreamweaver provides you with several tools and prebuilt behaviors to help you effectively retrieve and display information stored in a database. The following sections describe the Dreamweaver server behaviors and formatting elements, and how you can use them to display dynamic content.

This section covers the following conceptual topics:

at 9:31 AM Posted by Visuals India 0 comments

Dreamweaver provides the following server behaviors and formatting elements to let you enhance the display of dynamic data:

Formats let you apply different types of numerical, monetary, date/time, and percentage values to dynamic text.

For example, if the price of an item in a recordset reads 10.989, you can display the price on the page as $10.99 by selecting the Dreamweaver "Currency - 2 Decimal Places" format. This format displays a number using two decimal places. If the number has more than two decimal places, the data format rounds the number to the closest decimal. If the number has no decimal places, the data format adds a decimal point and two zeros.

Repeated Region server behaviors let you display multiple items returned from a database query, and let you specify the number of records to display per page.

Recordset Navigation server behaviors let you insert navigation elements that allow users to move to the next or previous set of records returned by the recordset. For example, if you choose to display 10 records per page using the Repeated Region server object, and the recordset returns 40 records, you can navigate through the records 10 at a time.

Recordset Status Bar server behaviors let you include a counter that shows users where they are within a set of records relative to the total number of records returned.

Show Region server behaviors let you choose to show or hide items on the page based on the relevance of the currently displayed records. For example, if a user has navigated to the last record in a recordset, you can hide the "next" link, and display only the "previous" records link.

at 9:30 AM Posted by Visuals India 0 comments

A powerful feature of Dreamweaver is the ability to present dynamic data within a structured page, and to apply typographic formatting using HTML and CSS. To apply formats to dynamic data in Dreamweaver, format the tables and placeholders for the dynamic data using the Dreamweaver formatting tools. When the data is inserted from its data source, it will automatically adopt the font, paragraph, and table formatting you specified.

To learn about Dreamweaver formatting features, and how to apply them to dynamic data elements, see Presenting Content with Tables and Inserting and Formatting Text.

at 9:30 AM Posted by Visuals India 0 comments

Recordset navigation links let users move from one record to the next, or from one set of records to the next. For example, after designing a page to display five records at a time, you might want to add links such as "Next" or "Previous" that let users display the five next or previous records.

Dreamweaver lets you create four types of navigation links to move through a recordset: First, Previous, Next, and Last. A single page can contain any number of these links, provided they all work on a single recordset. You can’t add links to move through a second recordset on the same page.

Recordset navigation links require the following dynamic elements:

  • A recordset to navigate
  • Dynamic content on the page to display the record or records
  • Text or images on the page to serve as a clickable navigation bar
  • A "Move To Record" set of server behaviors to navigate the recordset

You can add the last two elements using the Record Navigation Bar server object, or you can add them separately using the Dreamweaver design tools and the Server Behaviors panel. 

at 9:29 AM Posted by Visuals India 0 comments

If you want to create a recordset navigation bar that uses more complex layout and formatting styles than the simple table created by the Recordset Navigation Bar server object, you might prefer to create your own navigation bar. To do this, you must first create the necessary navigation links in either text or images, place them within the page in Design view, and assign individual server behaviors to each navigation link.

You can assign the following individual server behaviors to navigation links:

  • Move to first page
  • Move to last page
  • Move to next page
  • Move to previous page

If you would prefer to use the Dreamweaver built-in Recordset Navigation Bar server object to create a navigation bar, see Creating a navigation bar using the Recordset Navigation Bar server behavior.

at 9:28 AM Posted by Visuals India 0 comments

When creating a custom navigation bar, begin by creating its visual representation using the Dreamweaver page-design tools. You don’t have to create a link for the text string or image, Dreamweaver will create one for you.

The page you create the navigation bar for must contain a recordset to navigate. For more information, see Understanding recordsets.

A simple recordset navigation bar might look like this, with link buttons created out of images, or other content elements:

After you have added a recordset to a page, and have created a navigation bar, you must apply individual server behaviors to each navigation element. For example, a typical recordset navigation bar contains representations of the following links matched to the appropriate behavior:

Navigation link

Server behavior

Go to first page

Move to first page

Go to previous page

Move to previous page

Go to next page

Move to next page

Go to last page

Move to last page 

at 9:28 AM Posted by Visuals India 0 comments

Dreamweaver includes a set of server behaviors that let you show or hide a region based on the results returned by a recordset. For example, in a page using "Previous" and "Next" record links to navigate a results page, you can specify that the "Previous" records link be shown on all results pages except the first (which has no previous results), and that the "Next" records link be shown on all pages except the last (which has no next results).

You can also specify that a region be displayed or hidden based on whether the recordset is empty or not. If a recordset is empty (for example, no records were found matching the query), you can display a message informing the user that no records were returned. This is especially useful when creating search pages that rely on user input search terms to run queries against. Similarly, you can display an error message if there is a problem connecting to a database, or if a user’s user name and password do not match those recognized by the server.

The Show Region server behaviors are:

  • Show If Recordset Is Empty
  • Show If Recordset Is Not Empty
  • Show If First Page
  • Show If Not First Page
  • Show If Last Page
  • Show If Not Last Page

To learn how to apply the Show Region server behaviors, see Showing and hiding regions based on recordset results.

at 9:27 AM Posted by Visuals India 0 comments

The Repeat Region server behavior lets you display multiple records from a recordset within a page. Any dynamic data selection can be turned into a repeated region. However, the most common regions are a table, a table row, or a series of table rows.

The following example illustrates how the Repeat Region server behavior is applied to a table row, and specifies that nine records are displayed per page. The row itself displays four different records: city, state, street address, and zip code.

To create a table such as the one shown above, you must create a table containing dynamic content, and apply the Repeat Region server behavior to the table row containing the dynamic content. When the page is processed by the application server, the row is repeated the number of times specified in the Repeat Region server object, with a different record inserted in each new row.

To learn how to apply the Repeat Region server behavior, see Displaying multiple recordset results and Creating a table with a Repeat Region server behavior.

at 9:27 AM Posted by Visuals India 0 comments

Record counters give users a reference point when they are navigating through a set of records. Typically, record counters display the total number of records returned, and the current records being viewed. For example, if a recordset returns 40 individual records, and 8 records are displayed per page, the record counter on the first page would indicate "Displaying records 1-8 of 40."

To create a record counter for a page, you must first create a recordset for the page, an appropriate page layout to contain the dynamic content, and a recordset navigation bar. To learn more about creating these elements, and adding them to a page, see the following sections:

Once you have the above elements in the page, you can create a record counter.

Simple record counters

You can create a simple record counter using the Recordset Navigation Status server object. This server object inserts a complete record counter that you can apply text formatting to using Dreamweaver page-design tools. To learn more about this record counter, see Creating a record counter using the Recordset Navigation Status object.

Custom record counters

You can use individual record count behaviors to create custom record counters. Creating a custom record counter allows you to create a record counter beyond the simple, single row table inserted by the Recordset Navigation Status server object. You can arrange design elements in a number of creative ways, and apply an appropriate server behavior to each element.

The Record Count server behaviors are:

  • Display Starting Record Number
  • Display Ending Record Number
  • Display Total Records

Creating custom record counters leads you through the steps to create a record counter by applying the individual Record Counter server behaviors to a page’s design elements.

at 9:23 AM Posted by Visuals India 0 comments

Dreamweaver comes with several predefined data formats that you can apply to dynamic data elements. The data format styles include date and time, currency, numerical, and percentage formats.

To apply data formats to dynamic content:

  1. Select the dynamic content in either the Live Data window or its placeholder in the Document window.
  2. Select Window > Bindings to display the Bindings panel.
  3. Click the down arrow button in the Format column.

    If the down arrow is not visible, expand the panel.

  4. From the Format pop-up menu, select the data format category you want.

    Ensure that the data format is appropriate for the type of data you are formatting. For example, the Currency formats work only if the dynamic data consists of numerical data. Note that you cannot apply more than one format to the same data.

  5. Verify that the format was applied correctly by previewing the page in either the Live Data window or a browser. 

at 9:22 AM Posted by Visuals India 0 comments

You can customize the Dreamweaver existing data formats or create your own.

To customize a data format:

  1. Open a page that contains dynamic data in Design view.
  2. Select the dynamic data whose format you want to customize.
  3. Select Window > Bindings to display the Bindings panel.

    The bound data item whose dynamic text you selected will be highlighted.

  4. Click the down arrow in the Format column to expand the pop-up menu of available data formats.

    If the down arrow is not visible, expand the panel.

  5. Select Edit Format List from the pop-up menu.

    The Edit Format List dialog box appears.

  6. Complete the dialog box and click OK.

    For instructions, see Setting the Edit Format List dialog box options.

at 9:21 AM Posted by Visuals India 0 comments

You can create new data formats to suit any type of dynamic data you want to display.

To create a new data format:

  1. Open a page containing dynamic data in Design view.
  2. Select the dynamic data you want to create a custom format for.
  3. Select Window > Bindings to display the Bindings panel, and click the down arrow in the Format column.

    If the down arrow is not visible, expand the panel.

  4. Select Edit Format List from the pop-up menu.

    The Edit Format List dialog box appears.

  5. Click the Plus (+) button and select a format type.
  6. Define the format and click OK.
  7. Enter a name for the new format in the Name column.
  8. Click OK to close the Edit Format List dialog box. 

at 9:20 AM Posted by Visuals India 0 comments

Recordset navigation links let users move from one record to the next, or from one set of records to the next. For example, after designing a page to display five records at a time, you might want to add links such as Next or Previous that let users display the five next or previous records.

You can create recordset navigation links either by using the Recordset Navigation Bar server behavior or you can create a custom recordset navigation bar.

This section covers the following topics:

at 9:06 AM Posted by Visuals India 0 comments

You can create a recordset navigation bar in a single operation using the Recordset Navigation Bar server behavior. The server object adds the following building blocks to the page:

  • An HTML table with either text or image links
  • A set of "Move to" server behaviors
  • A set of "Show Region" server behaviors

The text version of the Recordset Navigation Bar looks like this:

The image version of the Recordset Navigation Bar looks like this:

Before placing the navigation bar on the page, make sure the page contains a recordset to navigate and a page layout in which to display the records.

After placing the navigation bar on the page, you can use the Dreamweaver design tools to customize the bar to your liking. You can also edit the "Move to" and "Show Region" server behaviors by double-clicking them in the Server Behaviors panel.

If you want to build the navigation bar block by block using the Dreamweaver design tools and the Server Behaviors panel, see Creating a custom recordset navigation bar.

To create the recordset navigation bar with the server object:

  1. In Design view, place the insertion point at the location on the page where you want the navigation bar to appear.
  2. Display the Recordset Navigation Bar dialog box (Insert > Application Objects > Recordset Navigation Bar).

    The Insert Recordset Navigation Bar dialog box appears.

  3. Select the recordset you want to navigate from the Recordset pop-up menu.
  4. From the Display Using section, select the format to display the navigation links on the page. The Text option places text links on the page, while the Images option lets you use graphical images as links.

    In the image version of the navigation bar, Dreamweaver uses its own image files. You can replace these images with image files of your own after placing the bar on the page.

  5. Click OK.

    Dreamweaver creates a table that contains text or image links that allow the user to navigate through the selected recordset when clicked. When the first record in the recordset is displayed, the First and Previous links or images are hidden. When the last record in the recordset is displayed, the Next and Last links or images are hidden.

    You can customize the layout of the navigation bar using the Dreamweaver design tools.

  6.  

at 9:06 AM Posted by Visuals India 0 comments

You can create a custom recordset navigation bar that uses more complex layout and formatting styles than that offered by the simple table used by the Recordset Navigation Bar server object.

To create your own recordset navigation bar, you must:

  • Design navigation links using either text or images
  • Place the links in the page in Design view
  • Assign individual server behaviors to each navigation link

To learn more about designing a custom recordset navigation bar, see Custom recordset navigation bars. If you prefer to use the Dreamweaver built-in Recordset Navigation Bar server object to create a navigation bar, see Creating a navigation bar using the Recordset Navigation Bar server behavior.

This procedure describes how to assign individual server behaviors to the navigation links.

To assign server behaviors to recordset navigation links:

  1. In Design view, select the text string or image on the page you want to use as a record navigation link.
  2. Open the Server Behaviors panel (Window > Server Behaviors) and click the Plus (+) button.
  3. Select Recordset Paging from the pop-up menu; then select a server behavior appropriate to that link from the listed server behaviors.

    If the recordset contains a large number of records, the Move to Last Record server behavior can take a long time to run when the user clicks the link.

  4. In the Recordset pop-up menu, select the recordset containing the records.
  5. Click OK.

    The server behavior is assigned to the navigation link.

at 9:06 AM Posted by Visuals India 0 comments

Dreamweaver includes a set of server behaviors that let you show or hide a region based on the results returned by a recordset. To learn more about the Show Region server behaviors, and how they can be used to show or hide recordset results, see Displaying and hiding regions based on recordset results.

To show a region only when it’s needed:

  1. In Design view, select the region on the page to show or hide.
  2. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button.
  3. Select Show Region from the pop-up menu, and then select one of the listed server behaviors.
  4. Click OK. 

at 9:05 AM Posted by Visuals India 0 comments

The Repeat Region server behavior lets you display multiple records from a recordset within a page. Any dynamic data selection can be turned into a repeated region. However, the most common regions are tables, table rows, or a series of table rows.

To learn more about using the Repeat Region server behavior, see Displaying multiple recordset results and Creating a table with a Repeat Region server behavior.

To create a repeated region:

  1. In Design view, select a region that contains dynamic content.

    The selection can be anything, including a table, a table row, or even a paragraph of text.

    To select a region on the page precisely, you can use the tag selector on the left corner of the document window. For example, if the region is a table row, click inside the row on the page, then click the rightmost tag in the tag selector to select the table row.

  2. Select Window > Server Behaviors to display the Server Behaviors panel.
  3. Click the Plus (+) button, and select Repeat Region.

    The Repeat Region dialog box appears.

  4. Select the name of the recordset to use from the pop-up menu.
  5. Select the number of records to display per page.
  6. Click OK.

    In the Document window, a thin, tabbed, gray outline appears around the repeated region. In the Live Data window (View > Live Data), the gray outline disappears and the selection expands to display the number of records you specified.

at 9:04 AM Posted by Visuals India 0 comments

The Dynamic Table server object lets you create a table containing dynamic content and apply the Repeat Region behavior from a single dialog box. This server object is especially useful as it simultaneously populates a table with dynamic content from a recordset and applies the Repeat Region server behavior.

To create a dynamic table:

  1. To insert a dynamic table:
    • Select Insert > Application Objects > Dynamic Data > Dynamic Table to display the Dynamic Table dialog box.
    • From the Application category of the Insert bar, select the Dynamic Table button in the Dynamic Data menu.

    The Dynamic Table dialog box appears.

  2. Select the recordset you want to use from the Recordset pop-up menu.
  3. Select the number of records to display per page.
  4. Input values for the table border, cell padding, and cell spacing if desired.

    The Dynamic Table dialog box retains the values you enter for table borders, cell padding, and cell spacing. If you are working on a project that will need several dynamic tables requiring the same look, you may want to enter the table layout values, as this will further simplify page development. Note that you can adjust these values after inserting the table using the table Property inspector.

  5. Click OK.

    A table and placeholders for the dynamic content defined in its associated recordset are inserted into the page.

    In this example, the recordset contains four records: FIRSTNAME, LASTNAME, TITLE, and DEPARTMENT. The table’s Heading row is populated with the names of each record item. You can edit the headings using any descriptive text you want, or replace them with representative images.

at 9:04 AM Posted by Visuals India 0 comments


Record counters let users know where they are within a given set of records relative to the total number of records returned. For this reason record counters are a useful behavior that can significantly add to the usability of a web page.

To learn more about record counters, see Record counters.

This section covers the following topics:

Creating a record counter using the Recordset Navigation Status object

Creating custom record counters

at 9:03 AM Posted by Visuals India 0 comments

The Recordset Navigation Status object creates a text entry on the page to display the current record status.

To use the Recordset Navigation Status server object:

  1. Place the insertion point where you want to insert the record counter.
  2. Select Insert > Application Objects > Recordset Navigation Status.

    The Insert Recordset Navigation Status dialog box is displayed.

  3. Select the recordset you want to use from the Recordset pop-up menu.

  4. Click OK.

    The Recordset Navigation Status server object inserts a text record counter that appears similar to the one shown below:

    This is a picture of the feature being described.

    You can use the Dreamweaver page-design tools to customize the record counter.

    When viewed in the Live Data window or a browser, the counter will appear similar to the one shown below:

    This is a picture of the feature being described.

at 9:03 AM Posted by Visuals India 0 comments

To create a custom record counter for a page, you must first create a recordset for the page, an appropriate page layout to contain the dynamic content, and a recordset navigation bar. To learn more about creating these elements and adding them to a page, see Record counters. After you have created the above elements in the page, you can create a custom record counter.

This example creates a record counter that will appear similar to that created in the previous section, Creating a record counter using the Recordset Navigation Status object. The record counter in this example will appear as follows:

Displaying records StartRow thru EndRow of RecordSet.RecordCount.

In this example, the text in sans-serif font represents the record count placeholders that will be inserted in the page.

To create a custom record counter:

  1. In Design view, enter the counter’s text on the page. The text can be anything you want. For example:
    Displaying records thru of . 
  2. Place the insertion point at the end of the text string.
  3. Open the Server Behaviors panel (Window > Server Behaviors).
  4. Click the Plus (+) button in the upper-left corner, and click Display Record Count. Within this submenu, select Display Total Records. The Display Total Records behavior is inserted into the page, and a placeholder is inserted where the insertion point was. The text string should now appear as:
    Displaying records thru of {Recordset1.RecordCount}. 
  5. Place the insertion point after the word records, and select the Display Starting Record Count Number from the Server Behaviors > Plus (+) button > Record Count panel. The text string should now appear as:
    Displaying records {StartRow_Recordset1} thru of {Recordset1.RecordCount}. 
  6. Now place the insertion point between the words thru and of, and select the Display Starting Record Count Number from the Server Behaviors > Plus (+) button > Record Count panel. The text string should now appear as:
    Displaying records {StartRow_Recordset1} thru {EndRow_Recordset1} of {Recordset1.RecordCount}. 
  7. Confirm that the counter functions correctly by viewing the page in the Live Data window (View > Live Data); the counter should now look similar to the following example:
    Displaying records 1 thru 8 of 40. 

    If the results page has a navigation link to move to the next set of records, clicking the link would update the record counter to read as follows:

    Showing records 9 thru 16 of 40. 

    Links don’t work in the Live Data window. To test them, you can use the Preview in Browser feature in Dreamweaver. Make sure the Preview Using Live Data Server option is selected in Preferences (Edit > Preferences > Preview in Browser (Windows) or Dreamweaver > Preferences > Preview in Browser (Macintosh)); then select File > Preview in Browser.

at 9:02 AM Posted by Visuals India 0 comments

You can use Macromedia Dreamweaver 8 to create web pages that display XML data. Displaying XML data involves retrieving information stored in a local or remote XML file and rendering that information in a web page. Dreamweaver provides methods for displaying information from XML files, as well as built-in XSLT objects and design features that let you enhance the presentation of your XML data.

This chapter contains the following sections:

About using XML and XSL with web pages

About server-side XSL transformations

About client-side XSL transformations

About XML data and repeating elements

About previewing XML data

Performing XSL transformations on the server

Performing XSL transformations on the client

Applying styles to XSLT fragments

Troubleshooting XSL transformations

at 9:01 AM Posted by Visuals India 0 comments


Extensible Markup Language (XML) is a language that lets you structure information. Like HTML, XML lets you structure your information using tags, but XML tags are not predefined as HTML tags are. Instead, XML lets you create tags that best define your data structure. Tags are nested within others to create a schema of parent and child tags. Like most HTML tags, all tags in an XML schema have an opening and closing tag.

The following example illustrates the basic structure of an XML file:

            03/01/2004              Charles Brown               04/08/2004              John Thompson      

In this example, each parent tag contains three child tags: , , and . But each tag is also a child tag of the tag, which is one level higher in the schema. You can name and structure XML tags in any way you like, provided that you nest tags accordingly within others, and assign each opening tag a corresponding closing tag.

XML documents do not contain any formatting -- they are simply containers of structured information. Once you have an XML schema, you can use the Extensible Stylesheet Language (XSL) to display the information. In the way that Cascading Style Sheets (CSS) let you format HTML, XSL lets you format XML data. You can define styles, page elements, layout, and so forth in an XSL file and attach it to an XML file so that when a user views the XML data in a browser, the data is formatted according to whatever you’ve defined in the XSL file. The content (the XML data) and presentation (defined by the XSL file) are entirely separate, providing you with greater control over how your information appears on a web page. In essence, XSL is a presentation technology for XML, where the primary output is an HTML page.

Extensible Stylesheet Language Transformations (XSLT) is a subset language of XSL that actually lets you display XML data on a web page, and "transform" it, along with XSL styles, into readable, styled information in the form of HTML. You can use Dreamweaver to create XSLT pages that let you perform XSL transformations using an application server or a browser. When you perform a server-side XSL transformation, the server does the work of transforming the XML and XSL, and displaying it on the page. When you perform a client-side transformation, a browser (such as Internet Explorer) does the work.

The approach you ultimately take (server-side transformations versus client-side transformations) depends on what you are trying to achieve as an end result, the technologies available to you, the level of access you have to XML source files, and other factors. Both approaches have their own benefits and limitations. For example server-side transformations work in all browsers while client-side transformations are restricted to modern browsers only (Internet Explorer 6, Netscape 8, Mozilla 1.8, and Firefox 1.0.2). Server-side transformations let you display XML data dynamically from your own server or from anywhere else on the web, while client-side transformations must use XML data that is locally hosted on your own web server. Lastly, server-side transformations require that you deploy your pages to a configured application server, while client-side transformations only require access to a web server.

For more information, see About server-side XSL transformations, and About client-side XSL transformations.

at 9:00 AM Posted by Visuals India 0 comments

Dreamweaver provides methods for creating XSLT pages that let you perform server-side XSL transformations. When an application server performs the XSL transformation, the file containing the XML data can reside on your own server, or anywhere else on the web. Additionally, any browser can display the transformed data. Deploying pages for server-side transformations, however, is somewhat complex, and requires that you have access to an application server.

When working with server-side XSL transformations, you can use Dreamweaver to create XSLT pages that generate full HTML documents (entire XSLT pages), or XSLT fragments that generate a portion of an HTML document. An entire XSLT page is similar to a regular HTML page. It contains a tag and a tag, and lets you display a combination of HTML and XML data on the page. An XSLT fragment is a piece of code, used by a separate document, that displays formatted XML data. Unlike an entire XSLT page, it is an independent file that contains no or tag. If you want to display XML data on a page of its own, you would create an entire XSLT page, and bind your XML data to it. If, on the other hand, you wanted to display XML data in a particular section of an existing dynamic page--for example, a dynamic home page for a sporting goods store, with sports scores from an RSS feed displayed on one side of the page--you would create an XSLT fragment and insert a reference to it in the dynamic page. Creating XSLT fragments, and using them in conjunction with other dynamic pages to display XML data, is the more common scenario.

The first step in creating these types of pages is to create the XSLT fragment: It is a separate file that contains the layout, formatting, and so on of the XML data that you eventually want to display in the dynamic page. Once you create the XSLT fragment, you insert a reference to it in your dynamic page (for example, a PHP or Macromedia ColdFusion page). The inserted reference to the fragment works much like an Server Side Include (SSI) -- the formatted XML data (the fragment) resides in a separate file, while in Design view, a placeholder for the fragment appears on the dynamic page itself. When a browser requests the dynamic page containing the reference to the fragment, the server processes the included instruction and creates a new document in which the formatted contents of the fragment appear instead of the placeholder.

You use the XSL Transformation server behavior to insert the reference to an XSLT fragment in a dynamic page. When you insert the reference, Dreamweaver generates an includes/MM_XSLTransform/ folder in the site’s root folder that contains a runtime library file. The application server uses the functions defined in this file when transforming the specified XML data. The file is responsible for fetching the XML data and XSLT fragments, performing the XSL transformation, and outputting the results on the web page.

The file containing the XSLT fragment, the XML file containing your data, and the generated run-time library file must all be on the server for your page to display correctly. (If you select a remote XML file as your data source -- one from an RSS feed, for example -- that file must of course reside somewhere else on the Internet.)

You can also use Dreamweaver to create entire XSLT pages for use with server-side transformations. An entire XSLT page works in exactly the same way as an XSLT fragment, only when you insert the reference to the entire XSLT page using the XSL Transformation server behavior, you are inserting the full contents of an HTML page. Thus, the dynamic page (the .cfm, .php, .asp, or .net page that acts as the container page) must be cleared of all HTML before you insert the reference.

Dreamweaver supports XSL transformations for ColdFusion, ASP, ASP.NET, and PHP pages.

For procedures on creating server-side XSL transformations, see Performing XSL transformations on the server.

at 9:00 AM Posted by Visuals India 0 comments

You can also perform XSL transformations on the client without the use of an application server. You can use Dreamweaver to create an entire XSLT page that will do this; however, client-side transformations require manipulation of the XML file that contains the data you want to display. Additionally, client-side transformations will only work in modern browsers (Internet Explorer 6, Netscape 8, Mozilla 1.8, and Firefox 1.0.2). For more information on browsers that do and don’t support XSL transformations, see www.w3schools.com/xsl/xsl_browsers.asp.

You begin by creating an entire XSLT page and attaching an XML data source. (Dreamweaver prompts you to attach the data source when you create the new page.) You can use Dreamweaver to create an XSLT page from scratch, or you can convert an existing HTML page to an XSLT page. When you convert an existing HTML page to an XSLT page you must attach an XML data source using the Bindings panel (Window > Bindings).

Once you’ve created your XSLT page, you must link it to the XML file containing the XML data by inserting a reference to the XSLT page in the XML file itself (much like you would insert a reference to an external CSS style sheet in the section of an HTML page). Your site visitors must view the XML file (not the XSLT page) in a browser. When your site visitors view the page, the browser performs the XSL transformation and displays the XML data, formatted by the linked XSLT page.

The relationship between the linked XSLT and XML pages is conceptually similar, yet different from the external CSS/HTML page model. When you have an HTML page that contains content (such as text), you use an external style sheet to format that content. The HTML page determines the content, and the external CSS code, which the user never sees, determines the presentation. With XSLT and XML, the situation is reversed. The XML file (which the user never sees in its raw form), determines the content while the XSLT page determines the presentation. The XSLT page contains the tables, layout, graphics, and so forth that the standard HTML usually contains. When a user views the XML file in a browser, the XSLT page formats the content.

When you use Dreamweaver to link an XSLT page to an XML page, Dreamweaver inserts the appropriate code for you at the top of the XML page. If you own the XML page to which you’re linking (that is, if the XML file exclusively lives on your web server), all you need to do is use Dreamweaver to insert the appropriate code that links the two pages. When you own the XML file, the XSL transformations performed by the client are fully dynamic. That is, whenever you update the data in the XML file, any HTML output using the linked XSLT page will be automatically updated with the new information.

If you don’t own the XML page to which you’re linking (for example, if you want to use XML data from an RSS feed somewhere out on the web), the workflow is a bit more complicated. To perform client-side transformations using XML data from an external source, you must first download the XML source file to the same directory where your XSLT page resides. Once the XML page is in your local site, you can use Dreamweaver to add the appropriate code that links it to the XSLT page, and post both pages (the downloaded XML file and the linked XSLT page) to your web server. When the user views the XML page in a browser, the XSLT page formats the content, just like in the previous example.

The disadvantage to performing client-side XSL transformations on XML data that comes from an external source is that the XML data is only partially "dynamic." The XML file that you download and alter is merely a "snapshot" of the file that lives elsewhere on the web. If the original XML file out on the web changes, you must download the file again, link it to the XSLT page, and repost the XML file to your web server. The browser only renders the data that it receives from the XML file on your web server, not the data contained in the original XML source file.

For procedures on creating client-side XSL transformations, see Performing XSL transformations on the client.

at 9:00 AM Posted by Visuals India 0 comments

The Repeat Region XSLT object lets you display repeating elements from an XML file within a page. Any region containing an XML data placeholder can be turned into a repeated region. However, the most common regions are a table, a table row, or a series of table rows.

The following example illustrates how the Repeat Region XSLT object is applied to a table row that displays menu information for a restaurant. The initial row displays three different elements from the XML schema: item, description, and price. When the Repeat Region XSLT object is applied to the table row, and the page is processed by an application server or a browser, the table is repeated with unique data inserted in each new table row.

When you apply a Repeat Region XSLT object in the Document window, a thin, tabbed, gray outline appears around the repeated region. When you preview your work in a browser (File > Preview in Browser), the gray outline disappears and the selection expands to display the specified repeating elements in the XML file, as in the previous illustration.

You might also notice that when you add the Repeat Region XSLT object to the page, Dreamweaver truncates the length of the XML data placeholder in the Document window. This is because Dreamweaver updates the XPath for the XML data placeholder so that it is relative to the path of the repeating element.

For example, the following code is for a table that contains two dynamic placeholders, without a Repeat Region XSLT object applied to the table:

The following code is for the same table with the Repeat Region XSLT object applied to it:

    

In the previous example, Dreamweaver has automatically updated the XPath for the items that fall within the Repeat Region (title & description) to be relative to the XPath in the enclosing tags, rather than the full document.

Dreamweaver generates context-relative XPath expressions in other cases as well. For example, if you drag an XML data placeholder to a table that already has a Repeat Region XSLT object applied to it, Dreamweaver automatically displays the XPath relative to the existing XPath in the enclosing tags.

To learn how to apply the Repeat Region XSLT object, see Displaying repeating XML elements.


at 8:59 AM Posted by Visuals India 0 comments

When you use Preview in Browser (File > Preview in Browser) to preview XML data that you’ve inserted in an XSLT fragment or an entire XSLT page, the engine that performs the XSL transformation differs from situation to situation. For dynamic pages containing XSLT fragments, the application server always performs the transformation. At other times, either Dreamweaver or the browser might be performing the transformation.

The following table summarizes the situations when using Preview in Browser, and the engines that perform the respective transformations:

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

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 application 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.

One disadvantage of this approach is that it makes it harder for you 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) responsible 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.

at 8:59 AM Posted by Visuals India 0 comments

Performing XSL transformations on the server

You can use Dreamweaver to create entire XSLT pages or XSLT fragments for use in dynamic web pages. An entire XSLT page is a page that, when transformed, generates a full HTML page. An XSLT fragment is a piece of code, used by a separate document, that, when transformed, displays XML data.

Macromedia recommends that you read About server-side XSL transformations before proceeding with any of the following procedures.

This section contains the following topics:

at 8:59 AM Posted by Visuals India 0 comments

This section provides a list of steps you need to follow to perform server-side XSL transformations, and refers you to the sections in the documentation that elaborate on each procedure.

Macromedia recommends that you read About using XML and XSL with web pages, About server-side XSL transformations, and About client-side XSL transformations before building pages that display XML data.

To perform server-side XSL transformations, follow these steps:

  • Set up a Dreamweaver site. See Setting Up a Dreamweaver Site.
  • Choose a server technology and set up an application server. See Setting up an application server.
  • Test the application server to make sure it is functioning correctly. For example, create a page that requires processing, and make sure that the application server processes the page. For a tutorial on how to do this, visit www.macromedia.com/go/dw_xsl.
  • Do one of the following:
  • If you haven’t already done so, attach an XML data source to the page. See Attaching XML data sources.
  • Bind your XML data to the XSLT fragment or to the entire XSLT page. See Displaying XML data in XSLT pages.
  • If appropriate, add a Repeat Region XSLT object to the table or table row that contains the XML data placeholder(s). See Displaying repeating XML elements.
  • Do one of the following:
    • Use the XSL Transformation server behavior to insert a reference to the XSLT fragment in your dynamic page. See Inserting XSLT fragments in dynamic pages.
    • Delete all of the HTML code from a dynamic page, and then use the XSL Transformation server behavior to insert a reference to the entire XSLT page in the dynamic page.
  • Post both the dynamic page and the XSLT fragment (or entire XSLT page) to your application server. If you are using a local XML file, you will need to post that as well.
  • View the dynamic page in a browser. When you do so, the application server transforms the XML data, inserts it in the dynamic page, and displays it in the browser. 

at 8:58 AM Posted by Visuals India 0 comments

You can create XSLT pages that let you display XML data on web pages. You can create either an entire XSLT page -- an XSLT page that contains a tag and a tag -- or you can create an XSLT fragment. When you create an XSLT fragment, you create an independent file that contains no body or head tag -- a simple piece of code that is later inserted in a dynamic page.

To create an XSLT page:

  1. Select File > New
  2. On the General tab of the New Document dialog box, select Basic page from the Category column and do one of the following:
    • Select XSLT (Entire page) from the Basics page column to create an entire XSLT page.
    • Select XSLT (Fragment) from the Basics page column to create an XSLT fragment.
  3. Click Create.

    The Locate XML Source dialog box appears, asking you to attach an XML data source.

  4. Do one of the following:
    • Select Attach a local file, click the Browse button, browse to a local XML file on your computer, and click OK.
    • Select Attach a remote file, enter the URL of an XML file on the Internet (such as one coming from an RSS feed), and click OK.

    Dreamweaver populates the Bindings panel with the schema of your XML data source.

  5. The following table provides an explanation of the various elements in the schema that might appear:

    Element

    Represents

    Details

    <>

    Required nonrepeating XML element

    An element that appears exactly once within its parent node

    <>+

    Repeating XML element

    An element that appears one or more times within its parent node

    <>?

    Optional XML element

    An element that appears zero or more times within its parent node

    Element node in boldface type

    Current context element

    Normally the repeating element when the insertion point is inside a repeat region

    @

    XML attribute

     

  6. Save your new page (File > Save) with the .xsl or .xslt extension (.xsl is the default). 

at 8:58 AM Posted by Visuals India 0 comments

You can also convert existing HTML pages to XSLT pages. For example, if you have a predesigned static page to which you want to add XML data, you can convert the page to an XSLT page, instead of creating an XSLT page and redesigning the page from scratch.

To convert an existing HTML page to an XSLT page:

  1. Open the HTML page that you want to convert.
  2. Select File > Convert > XSLT 1.0.

    Dreamweaver opens a copy of the page in the Document window. The new page is an XSL style sheet, saved with the .xsl extension.

at 8:57 AM Posted by Visuals India 0 comments

If you are starting with an existing XSLT page, or if you don’t attach an XML data source when creating a new XSLT page with Dreamweaver, you will need to attach an XML data source using the Bindings panel.

To attach an XML data source:

  1. In the Bindings panel (Window > Bindings), click the XML link.

    This is a picture of the feature being described.

  2. Do one of the following:
    • Select Attach a Local File, click the Browse button, browse to a local XML file on your computer, and click OK.
    • Select Attach a Remote File, enter the URL of an XML file on the Internet (such as one coming from an RSS feed).
  3. Click OK to close the Locate XML Source dialog box.

    Dreamweaver populates the Bindings panel with the schema of your XML data source. For a guide to the symbols in the schema, see Creating XSLT pages.

at 8:57 AM Posted by Visuals India 0 comments

Once you’ve created an XSLT page and attached an XML data source, you can bind data to the page.

To display XML data:

  1. Open an XSLT page with an attached XML data source. For instructions, see Creating XSLT pages.
  2. (Optional) Select Insert > Table to add a table to the page. A table helps you organize your XML data. For more information, see Presenting Content with Tables.
  3. In the Bindings panel, select an XML element and drag it to the place on the page where you want to insert data.
  4. An XML data placeholder appears on the page. The placeholder is highlighted and in curly brackets. It uses the XPath (XML Path language) syntax to describe the hierarchical structure of the XML schema. For example, if you drag the child element "title" to the page, and that element has the parent elements "rss," "channel," and "item," then the syntax for the dynamic content placeholder will be {rss/channel/item/title}.

    Once an XML data placeholder is on the page, you can double-click it to open the XPath Expression Builder. The XPath Expression builder lets you format selected data, or select other items from the XML schema. For more information, click the Help button in the XPath Expression builder.

  5. (Optional) Apply styles to your XML data by selecting an XML data placeholder and applying styles to it like any other piece of content using the Property inspector or the CSS Styles panel. Alternatively, you can use Design-time style sheets to apply styles to XSLT fragments. Each of these methods has its own set of benefits and limitations. For more information, see Applying styles to XSLT fragments.
  6. Preview your work in a browser (File > Preview in Browser)

at 8:56 AM Posted by Visuals India 0 comments

The Repeat Region XSLT object lets you display repeating elements from an XML data source in a web page. For example, if you are displaying article titles and descriptions from a news feed, and that news feed contains between 10 and 20 articles, each title and description in the XML file would probably be a child element of a repeating element.

Any region in Design view containing an XML data placeholder can be turned into a repeated region. However, the most common regions are tables, table rows, or a series of table rows.

To learn more about how the Repeat Region XSLT object works with XML data, see About XML data and repeating elements.

To display repeating XML elements:

  1. In Design view, select a region that contains an XML data placeholder or placeholders.

    The selection can be anything, including a table, a table row, or even a paragraph of text.

at 8:56 AM Posted by Visuals India 0 comments

After you’ve added a Repeat Region XSLT object to a region, you can make changes to it using the Property inspector.

To edit a Repeat Region XSLT object:

  1. Select the object by clicking the gray tab that surrounds the repeated region.
  2. In the Property inspector (Window > Properties), click the dynamic icon next to the Select text field.
  3. In the XPath Expression Builder, make your changes and click OK. 

at 8:56 AM Posted by Visuals India 0 comments

Once you have created an XSLT fragment, you can insert it in a dynamic web page using the XSL Transformation server behavior. When you add the server behavior to your page and view the page in a browser, an application server performs a transformation that displays the XML data from the selected XSLT fragment. Dreamweaver supports XSL transformations for ColdFusion, ASP, ASP.NET, or PHP pages.

To insert an XSLT fragment in a web page:

  1. Open an existing ColdFusion, ASP, ASP.NET, or PHP page.
  2. In Design view, place the insertion point in the location where you want to insert the XSLT fragment.
  3. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select XSL Transformation.
  4. In the XSL Transformation dialog box, click the Browse button and browse to an XSLT fragment or an entire XSLT page. For more information, see Creating XSLT pages.

    Dreamweaver automatically populates the next text field with the file path or URL of the XML file that is attached to the specified fragment. To change it, click the Browse button and browse to another file.

  5. (Optional) Click the Plus (+) button to add an XSLT parameter. For more information, see Using parameters with XSL transformations.
  6. Click OK.

    Dreamweaver inserts a reference to the XSLT fragment in the page. The fragment is not editable. You can double-click the fragment to open the fragment’s source file and edit it.

    Dreamweaver also creates an includes/MM_XSLTransform/ folder in the site’s root folder that contains a runtime library file. The application server uses the functions defined in this file to perform the transformation. For more information, see About server-side XSL transformations.

  7. Upload the dynamic page to your server (Site > Put). When Dreamweaver gives you the option of including dependent files, click Yes. The file containing the XSLT fragment, the XML file containing your data, and the generated run-time library file must all be on the server for your page to display correctly. (If you selected a remote XML file as your data source, that file must of course reside somewhere else on the Internet.) 
  8.  

at 8:55 AM Posted by Visuals India 0 comments

You can remove an XSLT fragment from a page by deleting the XSL Transformation server behavior used to insert the fragment. Deleting the server behavior deletes the XSLT fragment only -- it does not delete the associated XML, XSLT, or run-time library files.

To delete an XSLT fragment from a dynamic page:

  1. In the Server Behaviors panel (Window > Server Behaviors), select the XSL Transformation server behavior that you want to delete.
  2. Click the minus (-) button.

at 8:55 AM Posted by Visuals India 0 comments

Once you’ve added an XSLT fragment to a dynamic web page, you can edit the XSL Transformation server behavior at any time.

To edit an XSL Transformation server behavior:

  1. In the Server Behaviors panel (Window > Server Behaviors), double-click the XSL Transformation server behavior that you want to edit.
  2. Make your changes and click OK. 

at 8:54 AM Posted by Visuals India 0 comments

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.

To 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. For instructions, see Inserting XSLT fragments in dynamic pages.
  2. In the XSL Transformation dialog box, click the Plus (+) button next to XSLT Parameters.
  3. In the Add Parameters dialog box, enter a name for the parameter in the Name text box. The name can only contain alphanumeric characters. It cannot contain spaces.
  4. Do one of the following:
    • If you want to use a static value, enter it in the Value text box.
    • If you want to use a dynamic value, click the dynamic icon next to the Value text box, complete the Dynamic Data dialog box, and click OK. For more information, click the Help button in the Dynamic Data dialog box.
  5. In the Default Value text box, enter the value you want the parameter to use if the page receives no run-time value.
  6. Click OK.
  7. To edit an XSLT parameter:

    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. For instructions, see Inserting XSLT fragments in dynamic pages.
    2. Select a parameter from the XSLT parameters list.
    3. Click the Edit button.
    4. Make your changes and click OK.

    To delete an XSLT parameter:

    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. For instructions, see Inserting XSLT fragments in dynamic pages.
    2. Select a parameter from the XSLT parameters list.
    3. Click the minus (-)button. 
  8.  

at 8:54 AM Posted by Visuals India 0 comments

You can use Dreamweaver to create simple conditional regions or multiple conditional regions on an XSLT page. You can make a selection in Design view and apply a conditional region to the selection, or you can just insert a conditional region wherever the insertion point is in the document.

For example, if you wanted to display the word "Unavailable" next to the price of an item when the item is unavailable, you could type the word "Unavailable" on the page, select it, and then apply a conditional region to the selected text. Dreamweaver surrounds the selection with tags, and only displays the word on the page when the data match the conditions of the conditional expression.

To create a conditional XSLT region:

  1. Select Insert > XSLT Objects > Conditional Region, or Insert > XSLT Objects > Multiple Conditional Region.
  2. In the Conditional Region or Multiple Conditional Region dialog box, enter the conditional expression you want to use for the region.

    For more information, click the Help button in the dialog box.

  3. Click OK. 

at 8:54 AM Posted by Visuals India 0 comments

After you’ve added a conditional XSLT region to your page, you can make changes to it using the Property inspector.

To edit a Conditional Region XSLT object:

  1. Select the object by clicking the gray tab that surrounds the conditional region.
  2. In the Property inspector (Window > Properties), edit your conditional expression in the Test text box. 

at 8:53 AM Posted by Visuals India 0 comments

You can add XSL comment tags to a document, or you can wrap a selection in XSL comment tags.

To add XSL comment tags to a document:

  • Do one of the following:
    • In Design view, select Insert > XSLT Objects > XSL Comment, type the contents of the comment (or leave the text box blank), and click OK.
    • In Code view, select Insert > XSLT Objects > XSL Comment.

To wrap a selection in XSL comment tags:

  1. Switch to Code view (View > Code)
  2. Select the code you want to comment.
  3. On the Coding toolbar, click the Apply Comment button and select Apply Comment.

at 8:53 AM Posted by Visuals India 0 comments

You can perform XSL transformations on the client without the use of an application server. When you do so, a browser does the work of transforming the XML data, instead of an application server. You can use Dreamweaver to create such a page, however, client-side transformations require manipulation of the XML file containing the data you want to display. Additionally, client-side transformations will only work in modern browsers.

Macromedia recommends that you read About client-side XSL transformations before proceeding with any of the following procedures.

at 8:53 AM Posted by Visuals India 0 comments

This section provides a list of steps you need to follow to perform client-side XSL transformations, and refers you to the sections in the documentation that elaborate on each procedure.

Macromedia recommends that you read About using XML and XSL with web pages, About server-side XSL transformations, and About client-side XSL transformations before building pages that display XML data.

To perform client-side XSL transformations, follow these steps:

at 8:52 AM Posted by Visuals India 0 comments

Once you have an entire XSLT page with dynamic content placeholders for your XML data, you must insert a reference to the XSLT page in the XML page.

at 8:51 AM Posted by Visuals India 0 comments

When you create an entire XSLT page (that is, an XSLT page that contains and tags), you can display XML data on the page and then format the data like any other piece of content using the Property inspector or the CSS Styles panel. When you create an XSLT fragment for insertion in a dynamic page, however (for example, a fragment for insertion in an ASP, PHP, or Cold Fusion page), the rendering of styles in the fragment and in the dynamic page becomes more complicated. Although you work on an XSLT fragment separately from the dynamic page, it is important to remember that the fragment is intended for use within the dynamic page, and that the output from the XSLT fragment ultimately resides somewhere within the tags of the dynamic page. Given this workflow, it is important to make sure that you do not include elements (such as style definitions or links to external style sheets) in XSLT fragments. Doing so will cause the application server to place these elements into the of the dynamic page, thereby generating invalid markup.

For example, let’s say you’re creating an XSLT fragment for insertion in a dynamic page, and you want to 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 will contain a duplicate link to the style sheet (one in the section of the dynamic page, and another in the 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, Macromedia recommends that you use the following workflow:

  • First, attach an external style sheet to the dynamic page. (This procedure follows best practices 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. For more information, see Using Design-Time style sheets.

Once you have completed the previous steps you can apply existing styles or create new styles in your XSLT fragment using the same style sheet that you’ve attached to your dynamic page. You will have cleaner HTML output (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.

For more information on using CSS to format XSLT fragments, see www.macromedia.com/go/dw_xsl_styles.

at 8:51 AM Posted by Visuals India 0 comments

If you are having trouble getting your XSL transformations to work, a troubleshooting guide with the answers to many frequently asked questions is available at www.macromedia.com/go/dw_xsl_faq.

at 8:50 AM Posted by Visuals India 0 comments

The purpose of this dialog box is to specify an XML data source for the XLST page.

To set the dialog box options:

  • Do one of the following:
    • Select Attach a local file, click the Browse button, browse to a local XML file on your computer, and click OK.
    • Select Attach a remote file, enter the URL of an XML file on the Internet (such as one coming from an RSS feed), and click OK.

Clicking the Cancel button generates a new XSLT page with no attached XML data source. For information on attaching XML data sources, see Attaching XML data sources.

at 8:50 AM Posted by Visuals India 0 comments

The purpose of this dialog box is to attach an XSLT style sheet to an XML file.

To set the dialog box options:

  • Enter the path and filename of the XSLT style sheet, or click Browse and select it. 

at 8:50 AM Posted by Visuals India 0 comments


The purpose of this dialog box is to select a value in your XML data to display on your page. Dreamweaver inserts a tag at the insertion point. The advantage of using this method instead of dragging values from the XML schema tree is that you can format the value that is displayed.

One of the advantages of the XPath Expression Builder is that it identifies the current context based on your position in the XSL file when the dialog box is opened. The current context is in boldface type in the XML schema tree. As you make selections within this dialog box, it generates the correct XPath statements relative to your current context. This simplifies the process of writing correct XPath expressions for both beginners and advanced users.

XPath (XML Path Language) is a non-XML syntax for addressing portions of an XML document. It is used mostly as a query language for XML data, just as the SQL language is used to query databases. For more information on XPath, see the XPath language specification on the W3C website at www.w3.org/TR/xpath.

It is important to note that this dialog box is designed to help you build simple XPath expressions to identify a specific node. It does not allow you to edit the expressions by hand. If you need to create complex expressions, use this dialog box to get started and then customize your expressions in Code view or with the Property inspector.

To select a value to display on your page:

  1. In the XPath Expression Builder (Dynamic Text) dialog box, select any node in the XML schema tree.

    Dreamweaver writes the correct XPath expression in the Expression text box to identify the node.

    In the following example, you want to display the price subelement of the item node:


  2. This selection would insert the following code in your XSLT page:

     
  3. If you want, select a formatting option from the Format pop-up menu.

    Formatting a selection is useful when the value of your node returns a number. Dreamweaver provides a predefined list of formatting functions. For a complete list of available formatting functions and examples, see the Reference panel.

    In the following example, you want to format the price subelement as a currency with two decimal places:

    1. These options would insert the following code in your XSLT page:

       
    2. Click OK.
    3. To display the value of each node in the XML file, apply a repeat region to the element containing the dynamic text (for example, an HTML table row or a paragraph).

      For more information, see Displaying repeating XML elements.

    For more information and examples on selecting nodes to return a value, see the section in the Reference panel.

at 8:48 AM Posted by Visuals India 0 comments

The purpose of this dialog box is to select a node to repeat over and, optionally, to filter the results. If you have content selected when this dialog box is invoked, your content will be wrapped inside an block. If you do not have content selected, the block will be entered at the insertion point of your cursor.

One of the advantages of the XPath Expression Builder is that it identifies the current context based on your position in the XSL file when the dialog box is opened. The current context is in boldface type in the XML schema tree. As you make selections within this dialog box, it generates the correct XPath statements relative to your current context. This simplifies the process of writing correct XPath expressions for both beginners and advanced users.

XPath (XML Path Language) is a non-XML syntax for addressing portions of an XML document. It is used mostly as a query language for XML data, just as the SQL language is used to query databases. For more information on XPath, see the XPath language specification on the W3C website at www.w3.org/TR/xpath.

It is important to note that this dialog box is designed to help you build simple XPath expressions for repeat regions. It does not allow you to edit the expressions by hand. If you need to create complex expressions, use this dialog box to get started and then customize your expressions in Code view or with the Property inspector.

To select a node to repeat:

  • In the XPath Expression Builder (Repeat Region) dialog box, select the item to repeat in the XML schema tree.

    Dreamweaver writes the correct XPath expression in the Expression text box to identify the node.

In the following example, you want to repeat over each item node within the XML file.

When you click OK, the following code is inserted in your XSLT page:

    Content goes here  

In some cases, you may want to work with a subset of the repeating nodes--for example, you may only want items where an attribute has a specific value. In this case, you need to create a filter.

To filter the data to be repeated:

  1. In the XML schema tree, select a node to repeat.
  2. Click the Build Filter expander button.
  3. Click the Plus (+) button.

    Dreamweaver creates an empty filter.

  4. Enter the filter criteria in the following fields:

    Filter By specifies the repeating node that contains the data you want to filter by. The pop-up menu provides a list of ancestor nodes relative to the node you selected in the XML schema tree.

    Where specifies the attribute or subelement of the Filter By node that will be used to limit the results. You can select an attribute or subelement from the pop-up menu, or you can enter your own XPath expression in this field to identify children that exist deeper within the schema tree.

    Operator specifies the comparison operator to use in the filter expression.

    Value specifies the value to check for in the Filter By node. Enter the value. If dynamic parameters are defined for your XSLT page, you can select one from the pop-up menu.

  5. To specify another filter, click the Plus (+) button again.

    As you enter values or make selections in the pop-up menus, Dreamweaver changes the XPath expression in the Expression text box.

In the following example, you want to restrict the resultset to those item nodes where the value of the @available attribute is true.

When you click OK, the following code is inserted in your XSLT page:

      Content goes here   

You can create more complex filters that allow you to specify parent nodes as part of your filter criteria. In the following example, you want to restrict the resultset to those item nodes where the store’s @id attribute is equal to 1 and the item’s price node is greater than 5.

When you click OK, the following code is inserted in your XSLT page:

    Content goes here  

For more information and examples of repeat regions, see the section in the Reference panel.

 

at 8:46 AM Posted by Visuals India 0 comments

The purpose of this dialog box is to write a simple conditional expression to insert into your XSLT page. If content is selected when you open this dialog box, the content will be wrapped in an block. If you do not have content selected, the block will be entered at the insertion point.

This dialog box provides a way to create a simple conditional expression. It is recommended that you use the dialog box to get started and then customize the expression in Code view.

The element is similar to the if statement in other languages. The element provides a way for you to test a condition and take a course of action based on the result. The element allows you to test an expression for a single true or false value.

To insert a conditional region:

  1. In the Conditional Region dialog box, enter the condition.

    In the following example, you want to test to see if the context node’s @available attribute value is true.

    1. Click OK.

      The following code is inserted in your XSLT page:

          Content goes here   

    In addition to testing nodes for values, you can use any of the supported XSLT functions in any conditional statement. The condition is tested for the current node within your XML file. In the following example, you want to test for the last node in the resultset:


    For more information and examples on writing conditional expressions, see the section in the Reference panel.

at 8:46 AM Posted by Visuals India 0 comments

The purpose of this dialog box is to write a simple conditional expression to insert into your XSLT page. If content is selected when you open this dialog box, the content will be wrapped in an block. If you do not have content selected, the block will be entered at the insertion point.

This dialog box provides a way to create a simple conditional expression. It is recommended that you use the dialog box to get started and then customize the expression in Code view.

The element is similar to the case statement in other languages. The element provides a way for you to test a condition and take a course of action based on the result. The element allows you to test for multiple conditions.

To insert a multiple conditional region:

  1. In the Multiple Conditional Region dialog box, enter the first condition.

    In the following example, you want to test to see if the context node’s price subelement is less than 5.

    This is a picture of the feature being described.

  2. Click OK.

    In the example, the following code is inserted in your XSLT page:

               Content goes here               Content goes here      
  3. To insert another condition, place the insertion point in Code view between tag pairs or just before the tag, and then insert a conditional region (Insert > XSLT Objects > Conditional Region).

    After you specify the condition and click OK, Dreamweaver inserts another tag in the block.

For more information and examples on writing conditional expressions, see the sections in the Reference panel.

at 8:46 AM Posted by Visuals India 0 comments

The purpose of this Property inspector is to select a different XML node to repeat to create the repeat region.

To select a different XML node:

  • In the Select text box, enter a new node, and then press the lightning bolt icon and select the node from the XML schema tree that appears. 

at 8:13 AM Posted by Visuals India 0 comments

The purpose of this Property inspector is to change the condition used in a conditional region in your XSL page. The conditional region tests the condition and takes a course of action based on the result.

To change the condition used in the conditional region:

  • In the Test text box, enter a new condition, and then press Enter. 

at 8:13 AM Posted by Visuals India 0 comments

The purpose of this Property inspector is to change the condition used in a multiple conditional region in your XSL page. The multiple conditional region tests the condition and takes a course of action based on the result.

To change the condition used in the multiple conditional region:

  • In the Test text box, enter a new condition, and then press Enter. 

at 8:12 AM Posted by Visuals India 0 comments

In XSLT, some characters are not allowed in certain contexts. For example, you cannot use the less than sign (<) and the ampersand (&) in the text between tags or in an attribute value. The XSLT transformation engine will give you error if those characters are used incorrectly. To solve the problem, you can specify character entities to replace the special characters.

A character entity is a string of characters that represents other characters. Character entities are either named or numbered. A named entity begins with an ampersand (&) followed by the name or characters, and ends with a semicolon (;). For example, < represents the left angle bracket character (<). Numbered entities also start and end the same way, except that a hash sign (#) and a number specifies the character.

XSLT has the following five predefined entities:

Character

Entity Code

< (less-than)

<

& (ampersand)

&

> (greater-than)

>

" (quote)

"

‘ (apostrophe)

'

If you use other character entities in an XSL file, you need to define them in the DTD section of the XSL file. Dreamweaver provides several default entity definitions that you can see at the top of an XSL file created in Dreamweaver. These default entities cover a broad selection of the most commonly used characters.

Dreamweaver checks the XSL file for undefined entities when you preview your XSL file in a browser. If it finds an undefined entity, Dreamweaver notifies you in a message box.

If you preview an XML file attached to an XSLT file or if you preview a server-side page with an XSLT transformation, the server or browser (instead of Dreamweaver) notifies you of an undefined entity. The following is an example of a message you may get in Internet Explorer when you request an XML file transformed by an XSL file with a missing entity definition:

Reference to undefined entity 'auml'. Error processing resource 'http://localhost/testthis/list.xsl'. Line 28, Position 20  

ä

-------------------^

To correct the error in your page, you’ll need to add the entity definition to your page by hand.

To specify a missing entity definition:

  1. Look up the missing character in the character entity reference page on the W3C website at www.w3.org/TR/REC-html40/sgml/entities.html.

    This web page contains the 252 allowed entities in HTML 4 and XHTML 1.0.

    For example, if the character entity Egrave is missing, search for "Egrave" on the W3C web page. You will find the following entry:

     
  2. Make a note of the entity name and entity code in the entry.

    In the example, Egrave is the entity name, and &#200 is the entity code.

  3. With this information, switch to Code view in Dreamweaver and enter the following entity tag at the top of your XSL file (following the Doctype declaration and with the other entity tags):
    entityname "entitycode;"> 

    In the example, you would enter the following entity tag:

     
  4. Save your file.

If you repeatedly use the same character entities, you may want to permanently add their definitions in the XSL files Dreamweaver creates by default when you use File > New.

To add entity definitions to the XSL files Dreamweaver creates by default:

  1. Locate the following configuration file in the Dreamweaver application folder and open it in any text editor:

    Configuration/DocumentTypes/MMDocumentTypeDeclarations.xml

  2. Locate the declaration called mm_xslt_1:
     
  3. Enter the new entity tag or tags in the list of entity tags, as follows:
    entityname "entitycode;"> 
  4. Save the file and relaunch Dreamweaver.