Hi Pavani,
Sorry I didn't follow up on this on xalan-j-users right away. I've
read section 16.1 of XSLT 1.0 ("XML Output Method") [1] a little more
carefully, and there's one passage that I'm a little concerned about; it
reads as follows:
[[
The xml output method should use an algorithm to output additional whitespace
that ensures that the result if whitespace were to be stripped from the
output using the process described in [3.4 Whitespace Stripping] with the set of
whitespace-preserving elements consisting of just xsl:text would be the same when
additional whitespace is output as when additional
whitespace is not output.
]]
If the resulting document (before the effect of indent and
indent-amount) contained a fragment like the following, does the passage
that I've quoted from 16.1 mean that no additional whitespace should be
introduced before the xsl:text end-tag? If so, I believe the current
behaviour of SerializerToXML would meet this requirement, but the change
you're recommending would have to account for this case. Similarly, if
xml:space attributes appeared with the value "preserve".
<!--
There are several of blanks and line-feed characters
between the following tags
-->
<xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:text/>
I'm also unsure whether the behaviour with your patch would be
expected for a result like the following, where all blank lines between
the tags contain only linefeed characters.
<abc>
xyz
</abc>
I believe your patch would strip out any linefeed characters that appeared
in element content before any non-whitespace text, and leave alone any
that came after, so producing the following result.
<abc>xyz
</abc>
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab Tie Line 969-6044; Phone (905) 413-6044
mailto:[EMAIL PROTECTED]
Pavani Mukthipudi <[EMAIL PROTECTED]>
02/06/23 02:23 AM
Please respond to xalan-dev
To: [EMAIL PROTECTED]
cc:
Subject: [Patch-XalanJ] patch for bug #10009
Hi,
Please find the attached patch for bug #10009.
-Pavani
--
Pavani Mukthipudi
Sun Microsystems, Inc.
Phone: 91-80-2298989/87390
Index: SerializerToXML.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/java/src/org/apache/xalan/serialize/SerializerToXML.java,v
retrieving revision 1.16
diff -u -r1.16 SerializerToXML.java
--- SerializerToXML.java 21 Jun 2002 18:54:33 -0000 1.16
+++ SerializerToXML.java 23 Jun 2002 06:16:16 -0000
@@ -1584,13 +1584,15 @@
if (lengthClean > 0)
{
writer.write(chars, startClean, lengthClean);
-
+
lengthClean = 0;
}
if (CharInfo.S_LINEFEED == ch)
{
- writer.write(m_lineSep, 0, m_lineSepLen);
+ if (m_ispreserve) {
+ writer.write(m_lineSep, 0, m_lineSepLen);
+ }
startClean = i + 1;
}
@@ -1602,10 +1604,14 @@
}
}
- if (lengthClean > 0)
+ if (lengthClean > 0 && m_ispreserve)
{
writer.write(chars, startClean, lengthClean);
}
+
+ if (!checkWhite) {
+ m_isprevtext = true;
+ }
}
catch(IOException ioe)
@@ -1614,7 +1620,7 @@
}
- m_isprevtext = true;
+ // m_isprevtext = true;
}
/**
#### SerializerToXML.java has been removed from this note on June 24 2002
by Henry Zongaro