Eğer PHP içinde XSLT kullanarak ediyorsanız, XSLTProcessor::setParameter()
a> tarafından kendisine parametreler iletebilirsiniz. Sen ile XSL bu parametre beyan gerekecek
<xsl:param name="«param name»"/>
Örneğin ...
PHP:
// $xsl, $xml -- DOMDocument objects
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
$proc->setParameter(''/*default namespace*/, 'test_param', $aValue);
$proc->setParameter('', 'session_name', session_name());
$proc->setParameter('', 'session_id', session_id());
echo $proc->transformToXML($xml);
XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="test_param"/>
<xsl:param name="session_name"/>
<xsl:param name="session_id"/>
<xsl:template match="/">
<p>Your test parameter is: <xsl:value-of select="$test_param"/></p>
<p>Your session name is: <xsl:value-of select="$session_name"/></p>
<p>Your session ID is: <xsl:value-of select="$session_id"/></p>
<p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('http://example.com/index.php?',$session_name,'=',$session_id)"/>
</xsl:attribute>
Link with session
</a>
</p>
</xsl:template>
</xsl:stylesheet>