XSLT: Normalize the spaces of incoming xml values
This xslt can remove the tailing whitespaces in xml.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="normalize-space()"/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space()"/>
</xsl:template>
</xsl:stylesheet>
This is a very helpful XSLT! I was struggling with trailing whitespaces in XML files, and this solution worked perfectly. Thanks for sharing!"
ReplyDeletefranchise Expo
Franchise India Expo Delhi
Simple and effective approach to removing whitespaces. This is a must-have for anyone working with XML data."
ReplyDeleteSilo Top Dust Filter in delhi
vibro sifter delhi
reat post! It’s always nice to see small but impactful XSLT tricks like this. It works like a charm for cleaning up data."
ReplyDeleteheavy duty rack manufacturer delhi
Multi tier rack manufacturer delhi
This XSLT is a lifesaver when dealing with messy XML files. Thanks for posting such a useful solution!"
ReplyDeleteslotted Angle rack manufacturer delhii
pallet rack in delhi
This is a perfect way to handle extra spaces in XML files. It really streamlines the process and keeps the data clean."
ReplyDeleteDust collector manufacturer
Franchise Opportunities