Reputation: 11
I have an xsl that pick text from an html page:
<content name="body_content">
<xsl:apply-templates select="//body//text()"/>
</content>
It works fine, dropping all HTML tags and picking only text between the body tag.
The problem is when it drops the HTML tag and pick the text it concatenates the words, for instance:
<body>
<u>Internet Access</u>
<u>Web</u>
<u>new cars</u>
</body>
It will produce an XML field like this:
<content name="body_content">Internet Accesswebnew cars</content>
It is not really wrong because it is picking only the text as instructed but it is not working for me because of the words concatenation.
I am using XSL 1.0, does anyone know any manner to overcome this problem?
Thanks in advance
(the html tags may not make sense, I wrote this way only for this example)
Upvotes: 0
Views: 57
Reputation: 29052
You can modify your text()
nodes with the following template:
<xsl:template match="text()[normalize-space(.) != '']">
<txt><xsl:value-of select="." /><txt /> <!-- Customize this line -->
</xsl:template>
In this example every non-empty text()
node is wrapped in a <txt>
element. But you can customize it as you want.
Upvotes: 1