Not too sure how I should properly describe the issue, but what I’m facing is the following. I have quite some whitespace content in files that was originally html. I want to remove this and the easiest way to deal with this is using an identity template and add the following
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
Works fine, but a bit too well. Assume following example :
<p> some content with whitespaces and a <a href="some_link">link</a> and some <strong>text</strong>
If I use the identity template my result of course
looks like
<p>some content with whitespaces and a<a href="some_link">link</a>and some<strong>text</strong>
but I’d like to preserve the whitespace in front of my a and strong tags (or basically any tag within a ‘final’ string. Since these content can be in quite some tags (divs, anchors, whatever) building exceptions might work but would become pretty complex as I would need to have a template-match loop for all tags that can live inside another one and add spaces again after initial cleanup.
Any easier way to approach this ?
Thanks in advance again !
Perhaps