Tutorial PHP : XML and XSLT
Sample of the pdf document :
Getting News Off the Web
In this tutorial, you’ll learn how to create an XSLT fragment that formats news headlines from the National
Exasperator. The headlines are contained in an XML file. You’ll add the XSLT fragment to a dynamic
page on the same site you’ve been working on in tutorials throughout this book. To get started, you need to
grab the dynamic site files from www.sawmac.com/dw8/php/, and you’ll have to have set up a Web server
and application server as described in the first PHP tutorial. However, you don’t need to have finished any
of the other PHP tutorials to do this one.
Note: You’ll need to have XSLT support with your installation of PHP. If you used the
XAMPP package discussed in the first tutorial, it’s built-in so you needn’t worry. To
determine if XSLT support is enabled, create a page called info.php with this one line of
code in it <?php phpinfo(); ?>. Load the Web page from the Web server in your Web
browser—a page listing all sorts of info about your Web server and PHP appears. Search
the page for this “XSLT Support” and look to see if the word “enabled” is next to it (this
might also appear as “EXSLT Support”. If so, you’re golden, if not, you’ll need to
reinstall PHP with XML support—unfortunately, most Web hosting companies won’t do
this for you without a lot of nagging, so if it’s not enabled on your Web hosts server, dash
off an e-mail to their customer service department requesting that XSLT support be
enabled.
If you put the info.php page on your Web hosting server (the one connected live to the
internet) remove it. The information presented by this page can be extremely valuable to
hackers trying to figure out how to make your life miserable.
Start by creating a new XSLT fragment.
1. Choose File→New.
The New Document window appears.
2. Make sure the General tab is selected. Choose Basic Page from the category list, and XSLT (fragment)
from the basic page list. Click Create.
The Locate XML Source window appears (see Figure 24-1 on page 848 of the printed book), from
which you can tell Dreamweaver which XML file to use. This can be either the XML file located with
the tutorial files (feed.xml), or, if you’re connected to the Internet try the online version of the file.........
Click here for Download PDF / FREE
0 commentaires: