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:
1 |
<xsl:param name="login-txt-password" select="'Password'"/> |
And you want to convert it to something like this:
1 2 3 4 5 6 7 8 |
<xsl:param name="login-txt-password"> <xsl:choose> <xsl:when test="/data/fl-translations/item[@handle = 'login-txt-password']"> <xsl:value-of select="/data/fl-translations/item[@handle = 'login-txt-password']"/> </xsl:when> <xsl:otherwise>Password</xsl:otherwise> </xsl:choose> </xsl:param> |
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?
★ ★ ★ ★ ★