[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Cindy,
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.)
At 03:08 PM 12/11/2007, you wrote:
Re: [xsl] Elements within "as-is" environment misaligning
Subject: Re: [xsl] Elements within "as-is" environment misaligning From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 11 Dec 2007 16:21:22 -0500 |
Cindy,
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, Wendell
At 03:08 PM 12/11/2007, you wrote:
Hi-
I am experiencing problems when transforming sections of "as-is" code. I 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 "as-is").
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") = adPromptAlways</codeFocus> obConnection.Open
obRecordset.Open "sasuser.MyData", obConnection, adOpenDynamic, adLockOptimistic, adCmdTableDirect ' Operate on obRecordset. </code>
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-left="2pt" padding-right="2pt">obConnection.Provider = "SAS.IOMProvider.1"</fo:inline>
<fo:inline background-color="rgb(235, 235, 235)" padding-left="2pt" padding-right="2pt">obConnection.Properties("Prompt") = adPromptAlways</fo:inline> obConnection.Open
obRecordset.Open "sasuser.MyData", obConnection, adOpenDynamic, adLockOptimistic, adCmdTableDirect ' Operate on obRecordset. </fo:block>
I did notice that if I type a letter before the 2nd <codeFocus> element, 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" padding-right="2pt"><xsl:apply-templates/></fo:inline></xsl:template>
Does anyone have any ideas to prevent this from happening?
Any suggestions appreciated, Cindy Hunt
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Elements within "as-is" e, Michael Kay | Thread | RE: [xsl] Elements within "as-is" e, Cindy Hunt |
RE: [xsl] Elements within "as-is" e, Michael Kay | Date | Re: [xsl] Merging an dynamic set of, Martin Heiden |
Month |