xsl-list
[Top] [All Lists]

Re: [xsl] Removing white space from XML file

2007-04-12 05:52:32
David Carlisle wrote:
I think if you set indent="no" in the xsl:output tag of your XSL, it
removes all the extra white spaces between the XML nodes (I tested
this a while ago, if my memory is right then it should work).

no, indent="no", which is the default behaviour in the xml output
method, never removes white space, it simply tells the processor not to
add any extra white space.

The poster was looking for <xsl:strip-space elements="*"/>and the XPath
normalize-space() function.

Perhaps this (but I think that xsl:strip-space is redundant here)?

<xsl:strip-space elements="*" />

<xsl:template match="node() | @*">
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>

<xsl:template match="text()">
   <xsl:value-of select="normalize-space(.)" />
</xsl:template>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>