using page parameters in xsl:if statements
This is an open discussion with 2 replies, filed under XSLT.
Search
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.
This is probably embarrassing to me, but at this early hour, I can't work it out:
Does not work. How can I use the page parameter in my test expression?