[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using URL Variable in XSL (with PHP)

Subject: Re: Using URL Variable in XSL (with PHP)
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 11 Oct 2006 23:14:26 +0200
using url parameters in php
Leisha Cook wrote:

The link would be "../fac_profile.php?id=1"


$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);

[...]
<xsl:param name="id" />

I am not sure of the magic that PHP can perform for you, but shouldn't you be setting the parameter before starting the process? You declare a parameter but never set it. Perhaps it should be done like this in PHP:


$proc->setParameter("id", $_GET['id']);

[...]	
	<xsl:if test="faculty/person[@id] = $id">
[...]

This should be [@id = $id], as Trish pointed out. The difference being, "a person (with an attribute 'id') with a content that matches the value of $id" (your code) and "a person which has an 'id' attribute with a value that matches the value of the 'id' parameter".



Hth,


Cheers,
-- Abel Braaksma
-- http://www.nuntia.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.