takes a string as the first parameter, a number that defines how many characters to keep including the appended characters as the second parameter, and a string to append to the truncated string as the third parameter, so for example:
takes a string as the first parameter, a string that defines what to replace as the second parameter, and a string to put in as a replacment as the third parameter:
So what youre trying to do is take the value of a document property called "name" as a string, find "word1word2word3" inside that string and replace it with nothing, and then truncate the result to 16 chracters including "..."?
If that's true, then the corrected code above should work. If youre trying to do something else, please elaborate.
Replace items from variable
I've got a nodeset:
<xsl:variable name="list">
<Item><replace>word1</replace></Item>
<Item><replace>word2</replace></Item>
<Item><replace>word3</replace></Item>
</xsl:variable>
<xsl:variable name="rename" select="msxml:node-set($list)" />
With that I have a variable that I would like to remove all words from the nodeset in.
<xsl:value-of select="library:TruncateString(library:Replace(name,$rename/Item/replace,''),16,'...')" disable-output-escaping="yes"/>
With that I have a variable that I would like to remove all words from the nodeset in.
The above does not replace anything, what am I missing?
What precisely are you looking to achieve?
First of all the right syntax is:
umbraco.library:TruncateString
takes a string as the first parameter, a number that defines how many characters to keep including the appended characters as the second parameter, and a string to append to the truncated string as the third parameter, so for example:
will return "Myn..."
umbraco.library:Replace
takes a string as the first parameter, a string that defines what to replace as the second parameter, and a string to put in as a replacment as the third parameter:
will return "wherever"
So what youre trying to do is take the value of a document property called "name" as a string, find "word1word2word3" inside that string and replace it with nothing, and then truncate the result to 16 chracters including "..."?
If that's true, then the corrected code above should work. If youre trying to do something else, please elaborate.
is working on a reply...