PHP Tutorial XML and XSLT


PHP Tutorial XML and XSLT cover page
If you don’t own the book, what are you doing reading this? Please go out and by the book: it’s a good book, explains a lot more than this tutorial, and you’ll feel better about yourself knowing you did the right thing. Thanks. PHP Tutorial 5 XML and XSLT Getting News Off the Web In this tutorial, you’ll learn how to create an XSLT fragment that …

Figure PHP Tutorial 5-3. The “Select node to display” box let’s you use the content of an XML tag as a link. In XML-speak a node is one of the discrete parts of an XML document, such as a tag, a property, a comment, or even just plain text. In this case, node refers to either the contents of the tags, or the contents of the attribute of a tag. 8. In the Tag Selector (in the bottom-left corner of the Document window) , right-click (Control-click) the tag < div. mainContent >. From the shortcut menu that appears, select Remove Tag. Remember you placed that < div > tag temporarily in the file so you could accurately format the XML data using Cascading Style Sheets? You no longer need that tag, since the design is done and the dynamic page you’re adding this XSLT fragment to already has that tag in place. 9. Save and close the XSL file. Adding the XSLT Fragment to a Dynamic Page The last piece of the puzzle is adding the XSLT fragment to a dynamic page using a Dreamweaver Server Behavior. This procedure adds the necessary programming code to magically transform the XML, XSLT, and so on, into browser-readable HTML. 1. Open the page index. php located in the news folder in the root folder of the site. User your favorite technique: For example, choose File?Open and select the file, or open the Files panel, and double-click the file to open it. 2. Click in the empty space directly below the headline “Latest Headlines”. This spot is where you’ll place the XSLT fragment, but due to a small bug in Dreamweaver 8, you need to do one thing first. 3. In the Property Inspector choose “None” from the Format menu. The empty space was actually an empty paragraph complete with the HTML < p > tags. Changing the format to “none” removes the < p > tags, which is a good thing. Otherwise, all the HTML from the XSLT style sheet would be placed inside of this < p > tag, meaning you’d have
< h2 >and other < p > tags nested inside of the paragraph. That arrangement would not only make the page look weird when viewed in a browser, but it’s also invalid HTML—shame on you, Dreamweaver.< /h2 >

Download PHP Tutorial XML and XSLT.Pdf

Leave a Reply