Subject: RE: [xsl] XSLT, XML & PHP From: "Avula, Raj" <ravula@xxxxxxxxxxx> Date: Wed, 2 Apr 2003 14:36:34 -0800 |
You can use this <xsl:for-each select="Travelpackage[Resort_rating=4]"> or <xsl:apply-templates select="Travelpackage[Resort_rating=4]" /> Raj.. -----Original Message----- From: Anna Wagg [mailto:annawagg@xxxxxxxxxxx] Sent: Wednesday, April 02, 2003 12:44 PM To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] XSLT, XML & PHP Hi all, I'm a new to xslt and I'm trying to do something simple however with no positive result. Was trying to do many different things but I was not lucky. Could any one help me? Please. I'm trying to select and display all information of the resort with Resort_rating = 4. Below are 3 files: travel.xml, travel.xsl and xslt_travel.php. Thanks for you help and time, Anna. =========== travel.xml =========== <Recordset> <Travelpackage name="a"> <Country_name>Cuba</Country_name> <City>Cayo Coco</City> <Resort>Club Tryp Cayo Coco</Resort> <Resort_rating>4</Resort_rating> </Travelpackage> <Travelpackage name="b"> <Country_name>Cuba</Country_name> <City>Varadero </City> <Resort>Sol Club Paleras</Resort> <Resort_rating>3</Resort_rating> </Travelpackage> </Recordset> =========== travel.xsl =========== <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="utf-8" method="html" indent="yes" /> <xsl:template match="/Recordset"> <html> <head> <title>XSL Travel</title> </head> <body> <h1>Travel Packages</h1> <table border="0"> <xsl:for-each select="Travelpackage"> <tr> <td> <xsl:text>Country_name</xsl:text> </td> <td> <xsl:value-of select="Country_name" /> </td> </tr> <tr> <td> <xsl:text>City</xsl:text> </td> <td> <xsl:value-of select="City" /> </td> </tr> <tr> <td> <xsl:text>Resort</xsl:text> </td> <td> <xsl:value-of select="Resort" /> </td> </tr> <tr> <td> <xsl:text>Resort_rating</xsl:text> </td> <td> <xsl:value-of select="Resort_rating" /> </td> </tr> <tr> <td> <xsl:text>Resort_typeofholiday</xsl:text> </td> <td> <xsl:value-of select="Resort_watersports" /> </td> </tr> <tr> <td> <xsl:text>Resort_watersports</xsl:text> </td> <td> <xsl:value-of select="Resort_watersports" /> </td> </tr> <tr> <td> <xsl:text>Resort_meals</xsl:text> </td> <td> <xsl:value-of select="Resort_meals" /> </td> </tr> <tr> <td> <xsl:text>Resort_drinks</xsl:text> </td> <td> <xsl:value-of select="Resort_drinks" /> </td> </tr> <tr> <td> <xsl:text>Package_dateofdep</xsl:text> </td> <td> <xsl:value-of select="*/Package_dateofdep" /> </td> </tr> <tr> <td> <xsl:text>Package_price</xsl:text> </td> <td> <xsl:value-of select="*/Package_price" /> </td> </tr> <tr> <td colspan="2"><hr /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> =========== xslt_travel.php =========== <?php $xh = xslt_create(); xslt_set_base($xh, "file://C:/Program Files/Apache Group/Apache2/htdocs/XSLT-PHP/"); $result = xslt_process($xh, 'travel.xml', 'travel.xsl'); if ($result) { echo($result); } else { echo("There is an error in the XSL transformation...\n"); echo("\tError number: " . xslt_errno() . "\n"); echo("\tError string: " . xslt_error() . "\n"); exit; } ?> =========== _________________________________________________________________ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT, XML & PHP, Anna Wagg | Thread | RE: [xsl] XSLT, XML & PHP, Jon Steeves |
RE: [xsl] Parser implemented in XSL, Michael Kay | Date | RE: [xsl] XSLT, XML & PHP, Jon Steeves |
Month |