Search

This is probably embarrassing to me, but at this early hour, I can't work it out:

<xsl:if test="/data/static-{$current-page}-box/entry !=''">

Does not work. How can I use the page parameter in my test expression?

Try <xsl:if test="concat('/data/static-', $current-page, '-box/entry') !=''">, took me a while too.

I am wondering if it is possible to test if a (page)parameter exists without generating an error "the parameter does not exist".

To build XPath expressions dynamically I don't think you can evaluate a string like that. You could try:

/data/*[name() = concat('static-', $current-page, '-box')]/entry

So rather than building the node name itself, you use a wildcard (*) and a predicate to find the matching node name.

To test a page parameter, you can always define it at the very top of your stylesheet (above the first template):

<xsl:param name="param-name"/>

If it doesn't exist in the Symphony params list, the value of $param-name will be an empty string. Otherwise it will be filled with the Symphony param value.

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