I’m processing an XML document which has <paragraph> tags which contain text into a plain-text file. Sometimes the lines are broken in odd places, and sometimes they are too long. I have a template for paragraphs that simply runs the apply-template action and appends a couple of newlines.
Is there a way to reformat the text() in the paragraph similar to the unix ‘fmt’ command (which rewraps the stream of text to a normalized width) after the apply-templates has a chance to handle other tags within the paragraph (such as bold, em, etc).
Also, is there a way for each reformatted line to be indented, as you would normally do in a block quote in a plain-text document?
One easy solution is to use the
str-split-to-linestemplate from FXSL like this:When this transformation is applied on an XML document like this one:
The wanted output (words wrapped in lines with maximum width of 50) is produced: