You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by dongjiang tang <dt...@glassoc.com> on 2003/01/17 18:43:46 UTC
could a line break be lost during parsing?
Hi,
I am generating a html page using XSLT.
I have a element with the value of mutiple line of text in a xml stream, like below:
"line one
line two
line three"
I print it out right before the parsing:
System.out.println("XML = "+input.toString()) ;
reader.parse(new InputSource(new StringReader(input.toString()))) ;
I confirmed the element value is just like above with line break
But in the html, I want to break it into mutiple line using the following templates but DID not see the line break:
<xsl:template name="add-line-breaks">
<xsl:param name="string" select="." />
<xsl:choose>
<xsl:when test="contains($string, '
')">
<xsl:value-of select="substring-before($string, '
')" />
<br />
<xsl:call-template name="add-line-breaks">
<xsl:with-param name="string"
select="substring-after($string, '
')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
then I added some debuging code in my xsl file to show the element directly: <xsl:value-of select="@hdrL" /> (the @hdrL is the attribute holding that string value), then I went to the source after I re-generated the HTML page, I found that that element= "line one line two line three" without the line break
I feel somehow I lost the line break during the parsing.
Am I right about this? if yes, is there any confirguration to avoid this?
thank you !!
dongjiang