I have an XML document like this:
<xml>
<item>
<title>Article 1</title>
<text><![CDATA[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec lorem diam, eleifend sed mollis id, condimentum in velit.
Sed sit amet erat ac mauris adipiscing elementum. Pellentesque eget quam augue, id faucibus magna.
Ut malesuada arcu eu elit sodales sodales. Morbi tristique porttitor tristique. Praesent eget vulputate dui. Cras ut tortor massa, at faucibus ligula.]]></text>
</item>
</xml>
Where there are empty lines between the "paragraphs".
And I need to use XSLT transformation where the element will have each paragraph of text between < p > and < / p >. So my desired output would be like:
<h2>Article 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec lorem diam, eleifend sed mollis id, condimentum in velit.</p>
<p>Sed sit amet erat ac mauris adipiscing elementum. Pellentesque eget quam augue, id faucibus magna.</p>
<p>Ut malesuada arcu eu elit sodales sodales. Morbi tristique porttitor tristique. Praesent eget vulputate dui. Cras ut tortor massa, at faucibus ligula.</p>
So far I have an XSLT which looks like this:
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Page title</title>
</head>
<body>
<h1>Table of contents</h1>
<ol>
<xsl:for-each select="xml/item>
<li><xsl:value-of select="./title"/></li>
</xsl:for-each>
</ol>
<hr/>
<xsl:for-each select="xml/item">
<h2><xsl:value-of select="./title"/></h2>
<xsl:value-of select="./text" disable-output-escaping="yes"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
How to deal with replacements of \n
on the right places with paragraph HTML tags? I checked similar questions here, but I'm obviously not able to implement them to my problem.