Have you tried switching quotes/double quotes? If you're in a loop, it might also be best practice to include ./ before the data fragment, to make sure you're getting info from the current node in the loop
This function cuts the string after 20 characters, and insert ... at the end of the line. It's actually pretty usefull. If the EventDescription-field is content from a text-editor it would be smart to combine it with another extension called stripHtml like this:
Substring in XSLT
Another day, another question...
I've looked at various references and I believe this should work, but it does not:
<xsl:value-of select='substring(data [@alias = "EventDescription"],1,20)' disable-output-escaping="yes" />
I'm trying to shorten the field for display as it is rather lengthy. Can you help?
TIA.
Hi Darryl,
Have you tried switching quotes/double quotes? If you're in a loop, it might also be best practice to include ./ before the data fragment, to make sure you're getting info from the current node in the loop
Cheers,
/Dirk
Otherwise you could also try out the extension: umbraco.library:TruncateString
You can use it like this:
This function cuts the string after 20 characters, and insert ... at the end of the line. It's actually pretty usefull. If the EventDescription-field is content from a text-editor it would be smart to combine it with another extension called stripHtml like this:
This makes sure, that the truncateString doesn't break up a html-tag, like a link or so.
/KIm A
That worked perfectly Kim, thank you!
Sorry Dirk, I couldn't get yours to work...
Any time Darryl...
/Kim A
Hi Guys Im newbie in xslt how can i split a text I mean i have a string "Ticket # 123456 was placed on 12/10/2013" i need only 123456
Thanks
Hi Luis - welcome to the forum!
You will likely get much better results if you post a new question instead of continuing in this thread, since this one is already marked as solved.
/Chriztian
is working on a reply...