I would like to have a piece of code (XSL, Java) with which I can truncate strong typed text fields in an XML documents according to length definitions in an XSD.

Anybody seen such a piece of code before?