xsl-list
[Top] [All Lists]

Re: [xsl] Using URL Variable in XSL (with PHP)

2006-10-11 14:41:57
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[(_at_)id] = $id">
[...]

This should be [(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>