Displaying leading whitespace
Greetings,
I am trying to output an HTML document where leading spaces are significant. There are <Para> tags that have a "FirstLineIndent" attribute that can vary enough to not code individually for them.
The following code loops correctly, but I cannot get IE to recognize the leading spaces.
<xsl:template match="Para">
<p/>
<xsl:choose> . . . there are other tests here
<xsl:when test="@FirstLineIndent=*">
<xsl:variable name="firstlineindent" select="@FirstLineIndent"/>
<xsl:call-template name="for-loop">
<xsl:with-param name="count" select="1" />
<xsl:with-param name="indent" select="$firstlineindent" />
</xsl:call-template>
<xsl:value-of select="." />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="for-loop">
<xsl:param name="count" />
<xsl:param name="indent" />
<xsl:if test="$count <= $indent">
<xsl:text>#xa0;</xsl:text>
<xsl:call-template name="for-loop">
<xsl:with-param name="count" select="$count + 1" />
<xsl:with-param name="indent" select="$indent" />
</xsl:call-template>
</xsl:if>
</xsl:template>
So the problem appears to be with the &xa0; character. I must code for IE parser, as that is what the clients are using.
I have tried all variations (or at least a lot) on different whitespace characters. Also have tried the disable output escaping directive, and an attempt at character maps.
Any thoughts on how to get these leading spaces to appear, ie. not have each paragraph show as left flush?
Thanks,
Dan
|