Example XML:

<Body state="draft">The <Variable>6</Variable> foot tall man walked down
<Variable>5th</Variable> street.</Body>

Transforming the above "mixed mode" XML with the XSL below using
org.apache.xalan.xslt.Process (Xalan 2.4.1), produces:

<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format";
white-space-collapse="false" hyphenation-remain-character-count="2"
hyphenation-push-character-count="2" hyphenate="true" country="US"
language="en" font-size="10pt" space-after.optimum="5pt">The <fo:inline
color="#008080" font-style="italic" font-weight="bold">6</fo:inline> foot
tall man walked down <fo:inline color="#008080" font-style="italic"
font-weight="bold">5th</fo:inline> street.</fo:block>

However, using either of the transformer factories
(org.apache.xalan.xsltc.trax.TransformerFactoryImpl,
org.apache.xalan.processor.TransformerFactoryImpl) embedded in my
application to create a transformer produces a new line and tab immediately
before the <fo:inline> output elements.
I need to understand why this is happening because it is highly
undesireable.  Can anyone tell me if something is configured improperly, or
what is causing this?

Thanks for the help.


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 

xmlns:fo="http://www.w3.org/1999/XSL/Format";>
  <xsl:output method="html" encoding="UTF-8"/>

  <xsl:attribute-set name="variable">
    <!--xsl:attribute name="background-color">#008080</xsl:attribute-->
    <xsl:attribute name="color">#008080</xsl:attribute>
    <xsl:attribute name="font-style">italic</xsl:attribute>
    <xsl:attribute name="font-weight">bold</xsl:attribute>
  </xsl:attribute-set>

  <xsl:template match="Body">
     <xsl:variable name="state" select="@state"/>
      <fo:block
          space-after.optimum="5pt"
          font-size="10pt"
          language="en"
          country="US"
          hyphenate="true"
          hyphenation-push-character-count="2"
          hyphenation-remain-character-count="2"
          white-space-collapse="false">
        <xsl:call-template name="substitute">
          <xsl:with-param name="state" select="$state"/>
        </xsl:call-template>
      </fo:block>
  </xsl:template>

  <xsl:template name="substitute">
    <xsl:param name="state"/>
    <xsl:apply-templates>
      <xsl:with-param name="state" select="$state"/>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="Variable">
    <xsl:param name="state"/>
    <xsl:choose>
      <xsl:when test="$state = 'final'">
        <xsl:value-of select="."/>
      </xsl:when>
      <xsl:otherwise>
        <fo:inline xsl:use-attribute-sets="variable"><xsl:value-of
select="."/></fo:inline>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>


This electronic transmission is strictly confidential to Smith & Nephew and
intended solely for the addressee.  It may contain information which is
covered by legal, professional or other privilege.  If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy or take any action in reliance on this
transmission.  If you have received this transmission in error, please
notify the sender as soon as possible and destroy this message.
    

Attachment: test2.xsl
Description: Binary data

Attachment: test2.xml
Description: Binary data

Reply via email to