I have a xml that looks like this,
<Parent> Running text with marked up entities like
<Child>Entity1</Child>
and, text in the middle too, and
<Child> Entity2 </Child>
</Parent>
I have to preserve the line breaks and indentation when rendering the parent, but also apply a highlighting template to every child tag.
Now, the moment I capture the contents of the parent tag in a variable to do some string processing in XSL, I lose the underlying xml structure and cant apply the highlighting template to the children.
Whereas, I cant think of any other way to preserve the line breaks and indentation of the text contained in the parent tag.
Any ideas?
This stylesheet:
Output:
<div> Running text with marked up entities like<br/> <b>Entity1</b><br/> and, text in the middle too, and<br/> <b> Entity2 </b><br/></div>
Render as:
Running text with marked up entities likeEntity1
and, text in the middle too, and
Entity2
Edit: Better example preserving whitespace only text nodes.