·

photo credit: Surveillance2 via photopin (license)

Replace a XSL parameter in PhpStorm to a choose with a default value

Tags: , ,

Just a small something I wanted to share: When you want to convert a XSL parameter in PhpStorm to a choose with a default parameter, you can do so with a simple regexp. Say you’ve got something like this:

And you want to convert it to something like this:

Then just find and replace on the following regexp:
find: <xsl:param name="(.*)" select="'(.*)'"s?/>
replace: <xsl:param name="$1"><xsl:choose><xsl:when test="/data/fl-translations/item[@handle = '$1']"><xsl:value-of select="/data/fl-translations/item[@handle='$1']"/></xsl:when><xsl:otherwise>$2</xsl:otherwise></xsl:choose></xsl:param>
That’s it!

How would you rate this article?

Leave a Reply