I have something like this:
<node TEXT=' txt A '/> <node TEXT=' txt X '/> <node> <html> <p> txt Y </p> </html> </node> <node TEXT='txt B'/>
and i want to use XSLT to get this:
txt A txt X txt Y txt B
I want to strip all useless whitespaces and linebreaks of @TEXT’s and CDATA’s. The only XML-input that is giving structure to the output are the <node>-tags.
The following transformation:
when applied against this XML document
produces the wanted result:
txt A
txt X
txt Y
txt B
Do note the use of the standard XPath function normalize-space(), which strips off all leading and trailing spaces and replaces every sequence of other spaces with just one space.