Check URL for a '?' using XSLT

We use an XSLT/XML transformation to build sections of our page, and for some of the links we append parameters on the fly in the XSLT. However, there are instances where the link will already contain a '?' therefore instead of appending '?param=param' as default we need to append '&param=param'.

Is there a straightforward way of detecting whether a question mark exists in the URL?

Who is Participating?
Geert BormansConnect With a Mentor Information ArchitectCommented:
use the contains() function

contains(url, '?') returns a boolean

something like this
<xsl:when test="contains(url, '?')">
<xsl:value-of select="url"/>
<xsl:value-of select="url"/>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.