Search

This has to be trivial, but I couldn’t figure it out. I want to do something when the page-title parameter is ‘Home’. However, when I run the most obvious option:

<xsl:if test="{$page-title} = Home">
...
</xsl:if>

I get this error:

XSLTProcessor::importStylesheet(): xsl:if : could not compile test expression '{$page-title} = Home'
XSLTProcessor::transformToXml(): No stylesheet associated to this object

Never mind, guessed a couple more times and came up with:

<xsl:if test="$page-title = 'Home'">

Which works; leaving this thread for reference / future searchers looking how to add something to their Symphony homepage (or any other page using the $page-title parameter)

Just a quick note for posterity:

If you are in an <xsl:> element, you should not need the curly braces (see Matt’s example above), but when you are in another element, such as an html element, you can use the curly braces, also known as ‘attribute value templates’ to output the value of a variable param, e.g.:

<a href='{$root}/{$page-title}' />

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details