SharePoint Data View XSLT Tips and Tricks – Limit text field

SharePoint Data View XSLT Tips and Tricks – Limit text field

Here is an XSLT syntax used to limit the number of characters of a text column (in this example the title field), In case the text is more than 50 characters long this function will substring it from the start and up to its last occurrence of a white space and add 3 points after it –
{code type=html}

{/code}

If you don’t mind your text being cut off after the limited number of characters you could use this shorter XSLT syntax –
{code type=html}

{/code}


To count how many characters can fit your designated area you can use this nice online tool.

SharePoint Data View XSLT Tips and Tricks - Limit text field

Ellipsis

This is a cool trick to use, but if your text field should fit into one row only, you shouldn’t bother with it and it will be smarter to use this CSS Truncate String with Ellipsis technique which is supported in almost all browsers (even by IE8 believe it or not!).

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *