Online
 
Friday, 09 January 2009
 
 
More article:
Related Content:

Using XSLT to Describe HTML Output Using XML Input
 
Article Index
Using XSLT to Describe HTML Output Using XML Input
Page 2

XSLT is an XML document type definition adopted by the World Wide Web consortium (W3C) to carry data about how elements in an XML document should be mapped to visually defined HTML or XHTML elements suitable for display in a common Web browser.

Several modules in PHP provide the tools needed to help you to transform XML documents into their HTML or XHTML counterparts for display purposes, according to the XSLT templates that you provide.

XSL Stylesheets

XSL stylesheets are essentially XML-formatted lists of templates designed to match elements in an XML file whose document type is known in advance. Each time an element listed in the XSL stylesheet is found in the XML input document, the element and its associated data in the XML input document are replaced or altered according to the instructions given in the matching XSL stylesheet template.

For PHP users, the primary use of XSL stylesheets is for XSLT from XML- into HTML- or XHTML-formatted files. In short, XML elements in a document containing data that must be presented on the World Wide Web are transformed into HTML or XHTML tags according to the instructions given in the XSLT stylesheet file. Thus, the logical process of parsing an XML document into HTML or XHTML using XSLT goes something like this:

1.

Parse an element in the XML-formatted input document.

 

2.

Search for a template in the XSLT stylesheet that matches the newly parsed element.

3.

If a template is found that matches the element in question, replace the original element and data with new elements and (optionally) altered or transformed data, and process any additional XSLT instructions that occur in the matched template.

4.

If no template is found to match the element in question, do not process the element.

5.

Repeat this process for each element in the XML file until the entire element tree of the file in question has been processed.

Given the number of tools available to PHP users through PHP extension modules such as DOM XML, XSLT, and XML, and given the flexibility of XSLT elements, the process can be made slightly more complex than thisbut this list of steps provides a simple and essential overview of the logic behind XSLT stylesheets and their interaction with XML files to produce HTML or XHTML documents.



Tags: Add more tags...,
This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment. Tags: Simple PHP, Pear, Easy PHP, PHP Tutorial, PHP MySQL, XSLT, Sap Tutorial, CSS Tutorial, XSL FO Java, SQL Tutorial.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 4000
 Notify me of follow-up comments
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

Natural 289
Statistic


Last Post

 
Top! Top!