[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: To preserve line jumps on having gone on from XML
Javi,
Since the line breaks ("line jumps" is a good but unusual thing to call them) are not expressed in your XML, to convert them into markup requires processing the string value of the node. In this case, the best XSLT solution is to use a recursive template that takes the string and breaks it into pieces one at a time at the Line Break ('jump') character, which is character 
 or (as hexadecimal or decimal character references). This could look like: <xsl:variable name="delim" select="'
'"/> <xsl:template match="Body"> <p> <xsl:call-template name="mark-string"> <xsl:with-param name="string-left" select="string(.)"/> </xsl:call-template> </p> </xsl:template> <xsl:template name="mark-string"> <xsl:param name="string-left" select="string(.)"/> <xsl:if test="$block"> <xsl:variable name="segment"> <xsl:choose> <xsl:when test="contains($string-left,$delim)"> <xsl:value-of select="substring-before($string-left,$delim)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string-left"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:value-of select="$segment"/> <br/> <xsl:call-template name="mark-string"> <xsl:with-param name="string-left" select="substring-after($string-left,$delim)"/> </xsl:call-template> </xsl:if> </xsl:template> This is fully documented in the FAQ at http://www.dpawson.co.uk/xsl/sect2/N7240.html (look for "CLRF to BR"). In XSLT 2.0, where a tokenize() function is available, this is much easier. Cheers, Wendell BTW <Body Articulate>...</Body Articulate> is not well-formed XML; no space can be in the name. Try <Body_Articulate> or maybe <Body type="Articulate">. At 06:58 AM 7/30/2004, you wrote: Hello ___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|