Hemant Bist wrote:
Hi,
Is there any way I can tell xalan library to ignore the whitespace in
the xsl template? The whitespace in our xsl template is
mainly to indent the xsl template logic. Right now the workaround we
have is to use a perl script that wraps the whitespace in xsl template
in xml comments
I searched in the xalan site/list but did not find anything. Would
appreciate any pointers.
The best forum for general XSLT questions is the Mulberry Technologies
XSL list. I suggest you subscribe and post questions there.
Here is an example of what we do -- I am pasting file before removing
whitespace and after removing whitespace.
-------------------------xsl_with_white_space.xsl
----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
exclude-result-prefixes="xalan"
>
<xsl:template match="*"/>
<xsl:if test="$BaseActionType = 'new'">
<xsl:value-of select="'some string'"/>
</xsl:if>
</xsl:template>
None of the whitespace within the xsl:template instruction will be part
of the result tree. In general, within a stylesheet, all whitespace is
stripped when the stylesheet document is initially processed. The
details are here, in the XSLT recommendation:
http://www.w3.org/TR/xslt#strip
I can't imagine why Xalan-C would be generate whitespace text nodes in
the result tree from this snippet. Can you please provide a complete
example, including a source document, along the actual output and
expected output?
Dave