layton Posted June 12, 2008 Share Posted June 12, 2008 How would I go about preserving paragraphs or line breaks? I can't always control the information contained within an xml node. If somebody inputs two paragraphs in a text node, it would be good to treat it as two paragraphs and not one big one.I've tried wrapping the content in CDATA and using display-output-escaping="yes" but that isn't supported by firefox and I'm looking for a cross-browser solution.I understand that doing server-side transformations may be a good way to go, but unfortunately I don't have access to a dynamic environment. Anything that I do has to be client-side.I don't think the kind of text is really out of scope for xml and there has to be a way of achieving this.Any thoughts would be appreciated. Link to comment Share on other sites More sharing options...
boen_robot Posted June 12, 2008 Share Posted June 12, 2008 I'm not sure I'm seeing the problem. You're having an XML input that may look like <tag>One paragraphand a line brekAnother paragraphand another line brek</tag> Right?And you're outputting XHTML I guess?Aren't you essentially asking how to preserve line breaks in XHTML? Is using the <pre> element acceptable? Link to comment Share on other sites More sharing options...
Guest printzlau Posted July 28, 2008 Share Posted July 28, 2008 How would I go about preserving paragraphs or line breaks? I can't always control the information contained within an xml node. If somebody inputs two paragraphs in a text node, it would be good to treat it as two paragraphs and not one big one.I've done the following with succes:xml-file:...<text> <p>first</p> <p>second</p></text>... xsl-file: ...<xsl:for-each select="text/p"> <xsl:copy-of select="." /></xsl:for-each>... Link to comment Share on other sites More sharing options...
Kahor Posted August 22, 2008 Share Posted August 22, 2008 What about thisxsl-file: ...<xsl:for-each select="text/p"> <p><xsl:copy-of select="." /></p></xsl:for-each>... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.