Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>disable-output-escaping</code> isn't evil in itself, but there are only few cases where you should use it and this isn't one of them. In XSLT you work with trees, not markup string. Here's an XSTL 1.0 solution:</p> <pre><code>&lt;xsl:template match="/STORIES/STORY"&gt; &lt;component&gt; &lt;xsl:if test="ARTICLEBODY"&gt; &lt;xsl:call-template name="wrap-text"&gt; &lt;xsl:with-param name="text" select="ARTICLEBODY"/&gt; &lt;xsl:with-param name="delimiter" select="'&amp;#10;'"/&gt; &lt;xsl:with-param name="element" select="'p'"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:if&gt; &lt;/component&gt; &lt;/xsl:template&gt; &lt;xsl:template name="wrap-text"&gt; &lt;xsl:param name="text"/&gt; &lt;xsl:param name="delimiter"/&gt; &lt;xsl:param name="element"/&gt; &lt;xsl:choose&gt; &lt;xsl:when test="contains($text, $delimiter)"&gt; &lt;xsl:variable name="t" select="substring-before($text, $delimiter)"/&gt; &lt;xsl:if test="normalize-space($t)"&gt; &lt;xsl:element name="{$element}"&gt; &lt;xsl:value-of select="$t"/&gt; &lt;/xsl:element&gt; &lt;/xsl:if&gt; &lt;xsl:call-template name="wrap-text"&gt; &lt;xsl:with-param name="text" select="substring-after($text, $delimiter)"/&gt; &lt;xsl:with-param name="delimiter" select="$delimiter"/&gt; &lt;xsl:with-param name="element" select="$element"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:if test="normalize-space($text)"&gt; &lt;xsl:element name="{$element}"&gt; &lt;xsl:value-of select="$text"/&gt; &lt;/xsl:element&gt; &lt;/xsl:if&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:template&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload