Jump to content

preserve paragraphs


Recommended Posts

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 post
Share on other sites

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 post
Share on other sites
  • 1 month later...
Guest printzlau
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 post
Share on other sites
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...