4 users online. Create an account or sign in to join them.Users
XSLT When statement not working with URL param
This is an open discussion with 2 replies, filed under XSLT.
Search
<xsl:when test="$location">
Try this instead:
<xsl:when test="not($location = '')">
I found the problem. My XSLT was fine, the issue was how I was defining URL parameters in Symphony.
I had location, counselor and so forth when I needed location/counselor instead.
I knew it was something stupid. Thanks for the assist!
Create an account or sign in to comment.
Here’s my XSLT:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="../utilities/master.xsl"/> <xsl:param name="location"/> <xsl:template match="data"> <xsl:choose> <xsl:when test="$location"> <h1>Location</h1> </xsl:when> <xsl:otherwise> <h1>About Us</h1> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>The page has ‘location’ defined as a URL param and it’s filtering my datasource as it should but when I try the page with a location defined it doesn’t show the new H1.
I’m sure it’s something stupid I’m missing. I’m used to putting “not($entry)” and so forth but I’m planning on having more URL params so that’s not really an option this time.