Reputation: 111
input xml:
<keywords>
<ce:keyword>
<ce:text>
spacetime
</ce:text>
</ce:keyword>
<ce:keyword>
<ce:text>
cauchy surface
</ce:text>
</ce:keyword>
</keyword>
xsl so far i am using is,
<xsl:copy-of select="replace(ce:keywords/ce:keyword,'\s*','')"/>
i used this xsl:copy-of and replace function .but no changes in my output xml.
i want to remove spaces or empty newline in between the .
can anyone help me to this?
my expexted output xml is,
<keywords>
<ce:keyword>
<ce:text>spacetime</ce:text>
</ce:keyword>
<ce:keyword>
<ce:text>cauchy surface</ce:text>
</ce:keyword>
</keywords>
Upvotes: 0
Views: 164
Reputation: 7173
use
<xsl:template match="ce:text">
<xsl:copy>
<xsl:value-of select="normalize-space(.)"/>
</xsl:copy>
</xsl:template>
normalize-space
function takes care of the extraneous spaces.
Upvotes: 1