[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: White space treatment issue

Subject: Re: White space treatment issue
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 18 Jan 2011 09:00:58 +0000
Re:  White space treatment issue
On 18/01/2011 08:23, Karl Stubsjoen wrote:
Thanks for the pointers.  I have created a sample xml and xslt so you
can run yourself.  I get 2 different results on the lines in the
stylesheet with<fo:inline>testing</fo:inline>
<fo:inline>testing</fo:inline>
<fo:inline>testing</fo:inline>
<fo:inline>testing</fo:inline>

In a block with linefeed-treatment set to "preserve".

Saxon collapses the lines following each<fo:inline>  so that you end up with:
testingtestingtestingtestingtesting

MvpXslTransform preserves the lines so you get:
testing
testing
testing
testing
testing
You haven't answered the first question: what is the output of the XSLT in each case? I think you're showing the output of the XSL-FO processor.

This feels to me like a problem at the XSL-FO stage of the pipeline rather than the XSLT stage.

Michael Kay
Saxonica
I kinda think, but I don't know the standards to a high degree that
the latter would be the expected result, but that is for you all to
chime in on!  Anyhow, here is the xml and the xslt.

Thanks for looking at this.  And by the way the goal is still:  using
MvpXslTranform achieve the same results as Saxon (right or wrong).

<root>
     <client>
         <name>Bob</name>
         <address>
             <line1>222 Poplar</line1>
             <line2>Apt #92</line2>
             <line3>Dreamy Draw, AZ 85028</line3>
         </address>
     </client>
</root>


<xsl:template match="/"> <fo:root> <fo:layout-master-set> <fo:simple-page-master master-name="master"> <fo:region-body></fo:region-body> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="master"> <fo:flow flow-name="xsl-region-body"> <fo:block-container position="absolute" left=".25in" top="1in"> <fo:block> <xsl:value-of select="root/client/name"/> </fo:block> </fo:block-container> <fo:block-container position="absolute" left=".35in" top="1.25in"> <xsl:apply-templates select="root/client/address/*"/> </fo:block-container> <fo:block-container position="absolute" left="1.25in" top="1.85in"> <fo:block linefeed-treatment="preserve"> <fo:inline>testing</fo:inline> <fo:inline>testing</fo:inline> <fo:inline>testing</fo:inline> <fo:inline>testing</fo:inline> </fo:block> </fo:block-container> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template>

<xsl:template match="address/*">
     <fo:block><xsl:value-of select="."/></fo:block>
</xsl:template>

On Mon, Jan 17, 2011 at 5:11 PM, Michael Kay<mike@xxxxxxxxxxxx> wrote:
On 17/01/2011 23:20, Karl Stubsjoen wrote:
I can't figure out where/when white space is getting introduced, and
if it is introduced in the stylesheet or the xml document or I guess
maybe both.
I am using MvpXslTransform in a C# .NET application.
When I run the transformation straight with Saxon there is no issue.
When I run the same thing with MvpXslTransform, I get extra spaces in
the output.  There is linefeed-treatment set to true in the fo
document, but somehow extra lines are injected.
First, eliminate XSL-FO from the equation. Is the XSLT output different from
the two processors?

Unwanted whitespace in XSLT output comes from one of three places:

(a) whitespace being copied from the source document

(b) whitespace copied from the stylesheet

(c) indentation added by the serializer

First see what the extra whitespace looks like. Is it adjacent to
non-whitespace text. If so, where does that text come from? Is it in mixed
content elements or in element-only content? Does it include newline
characters? Is it the entire content of an element? This information will
often lead you to identify one of the three causes above as the most likely.

The fact that you're getting different output from different processors is
another clue. It tends to suggest a difference in parsing or serialization
behaviour rather than in the transformation proper.

Michael Kay
Saxonica

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.