RE: [xsl] Elements within "as-is" environment misaligning

Subject: RE: [xsl] Elements within "as-is" environment misaligning
From: "Cindy Hunt" <Cindy.Hunt@xxxxxxx>
Date: Tue, 11 Dec 2007 16:23:47 -0500
Thanks to both Wendell and Michael - I did have indent="yes".

I just ran my code again and it seems to be working as expected now.

I appreciate your help,

-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
Sent: Tuesday, December 11, 2007 4:21 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Elements within "as-is" environment misaligning


This is the kind of thing that can happen as an unwitting and
unintended consequence of using <xsl:output indent="yes"/>. Check
whether you have this setting; if you do, and you are passing
serialized XML to your formatter, the serializer could be inserting
the unwanted whitespace.

Indented output is a nice feature to have when developing, as it
makes the results easier to read, but as a general rule, it's safer
to run production systems without it, since serializers are rarely
smart enough to perform indenting exactly and only where it's a good
idea. (Note that you are able to get different behavior from your
serializer based on the exact placement of bits of text in line with
the elements.)

I hope that helps,

At 03:08 PM 12/11/2007, you wrote:
>I am experiencing problems when transforming sections of "as-is" code.
>have an element which contains a sample of programming code within it.
>Within the code sample I have some additional elements I call
><codeFocus> which will highlight that part of the code when it is
>formatted. During the XSL-FO transform, the alignment around these
><codeFocus> elements gets messed up. The first one seems fine but then
>the 2nd one has an extra blank line that appears before it starts and
>the start tag is shifted over to the right (so it is no longer
>I am using a Saxon parser and version 1.0. I use Antenna House for the
>FO formatting but the problem occurs before the doc is formatted.
>My XML input:
><code>Dim obConnection As New ADODB.Connection
>     Dim obRecordset As New ADODB.Recordset
>     <codeFocus>obConnection.Provider = "SAS.IOMProvider.1"</codeFocus>
>     <codeFocus>obConnection.Properties("Prompt") =
>     obConnection.Open
>     obRecordset.Open "sasuser.MyData", obConnection, adOpenDynamic,
>adLockOptimistic, adCmdTableDirect
>     ' Operate on obRecordset.
>My FO output (note the blank line between the 2 fo:inline and how the
>2nd one indents in now):
>                      <fo:block font-family="'Courier Standard',
>'monospace', 'Arial Unicode MS' " font-size="8.5pt" font-stretch="90%"
>line-height="12pt" start-indent="93pt+15pt"
>linefeed-treatment="preserve" white-space-treatment="preserve"
>white-space-collapse="false" wrap-option="no-wrap" space-before="6pt"
>space-after="0pt">Dim obConnection As New ADODB.Connection
>     Dim obRecordset As New ADODB.Recordset
>     <fo:inline background-color="rgb(235, 235, 235)"
>padding-right="2pt">obConnection.Provider =
>                         <fo:inline background-color="rgb(235, 235,
>= adPromptAlways</fo:inline>
>     obConnection.Open
>     obRecordset.Open "sasuser.MyData", obConnection, adOpenDynamic,
>adLockOptimistic, adCmdTableDirect
>     ' Operate on obRecordset.
>I did notice that if I type a letter before the 2nd <codeFocus>
>it works fine and doesn't insert the extra line or shift over.
>I even tried defining my xsl:template on a line by itself as not to get
>any carriage returns:
>         <xsl:template match="codeFocus"><fo:inline
>background-color="rgb(235, 235, 235)" padding-left="2pt"
>Does anyone have any ideas to prevent this from happening?
>Any suggestions appreciated,
>Cindy Hunt

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
   Mulberry Technologies: A Consultancy Specializing in SGML and XML

Current Thread