Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Probably an easy answer but I don't quite know the syntax.
I want to convert a false value on a check box in the admin section, which returns 0, to a string that outputs the string word "False" so I can use it on the front end.
Anyone have any suggestions?
Hi Carlos,
There's (atleast) two ways to do this - use whichever you feel is right:
<xsl:template match="/"> <!-- Grab the value --> <xsl:variable name="checkboxValue" select="$currentPage/checkboxPropertyName" /> <!-- Method 1 --> <xsl:value-of select="translate(string(boolean(number($checkboxValue))), 'ft', 'FT')" /> <!-- Method 2: --> <xsl:choose> <xsl:when test="$checkboxValue = 1"> <xsl:text>True</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>False</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template>
/Chriztian
Perhaps a bit more complecated still more righteous way could be even:
<xsl:value-ofselect="umbraco.library:GetDictionaryItem(boolean(number($checkboxValue)))"/>
and than to define True/False in the dictionary.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
convert XSLT number to string
Probably an easy answer but I don't quite know the syntax.
I want to convert a false value on a check box in the admin section, which returns 0, to a string that outputs the string word "False" so I can use it on the front end.
Anyone have any suggestions?
Hi Carlos,
There's (atleast) two ways to do this - use whichever you feel is right:
/Chriztian
Perhaps a bit more complecated still more righteous way could be even:
and than to define True/False in the dictionary.
is working on a reply...