This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Detecting a linefeed in input text, how?


I'm processing a node that has embedded line feed characters.  I'm 
trying to output the original lines, but with spaces added to the front.  
I wrote the following template, but it doesn't detect the line feeds:

<xsl:template name="indenter">
<xsl:param name="block"/>
<xsl:param name="indent"/>
<xsl:variable name="rest" select="substring-after($block,'#0A')"/>
<xsl:choose>
<xsl:when test="string-length($rest)=0"><xsl:value-of 
select="$indent"/><xsl:value-of select="$block"/></xsl:when>
<xsl:otherwise>
<xsl:value-of select="$indent"/><xsl:value-of select="substring-
before($block,'#0A')"/>
<xsl:call-template name="indenter">
    <xsl:with-param name="block" select="$rest"/>
    <xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


Called by:

<xsl:call-template name="indenter">
    <xsl:with-param name="block" select="."/>
    <xsl:with-param name="indent" select="'     '"/>
</xsl:call-template>

Any ideas?

Steve Carton


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]