How to wrap text to fit window in XSLT
问题 I am extracting data from XML using XSLT 2.0. The data has long lines and I want to fit them into window size by automatically breaking lines. Is it possible in XSLT? 回答1: You can use the standard XSLT 2.0 function unparsed-text() to read a text file directly in your XSLT 2.0 code. Then just use : replace(concat(normalize-space($text),' '), '(.{0,60}) ', '$1
') Explanation : This first normalizes the white space, deleting the leading and trailing sequences of whitespace-only characters and