Subject: Re: [xsl] Removing line breaks without normalize-space() From: "Spencer Tickner" <spencertickner@xxxxxxxxx> Date: Tue, 19 Sep 2006 10:05:06 -0800 |
<?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="cr"><xsl:text> </xsl:text></xsl:variable> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template>
<xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="text()"> <xsl:value-of select="translate(., $cr, '')"/> </xsl:template>
Hi,
Is there any way to remove line breaks without deleting the whitespace in-between elements? For example, suppose you started with the following XML:
<paragraph> <sentence>Some words are <i>italicized</i> and some words are in <b>bold</b>.</sentence> <sentence>Some words are <u>underlined</u>.</sentence> </paragraph>
I'd like to remove the line breaks, but otherwise retain any existing whitespace between elements, resulting in the following XML:
<paragraph><sentence>Some words are <i>italicized</i> and some words are in <b>bold</b>.</sentence><sentence>Some words are <u>underlined</u>.</sentence></paragraph>
I'm trying to avoid sentences whose contents run together when I process the text.
Thanks!
Mark
--
Mark Peters Senior Technical Writer Saba Software
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Removing line breaks without , Mark Peters | Thread | Re: [xsl] Removing line breaks with, Abel Braaksma |
Re: [xsl] Getting the Base Characte, Abel Braaksma | Date | Re: [xsl] Removing line breaks with, Abel Braaksma |
Month |