Here is a short solution that doesn't use any <xsl:choose>
, <xsl:when>
or <xsl:otherwise>
:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<ul>
<xsl:apply-templates select="research"/>
</ul>
</xsl:template>
<xsl:template match="research/text()[normalize-space()]" name="split">
<xsl:param name="pText" select="."/>
<xsl:if test="normalize-space($pText)">
<li>
<xsl:call-template name="replace">
<xsl:with-param name="pText" select="substring-before(concat($pText, ';'), ';')"/>
</xsl:call-template>
</li>
<xsl:call-template name="split">
<xsl:with-param name="pText" select="substring-after($pText, ';')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="replace">
<xsl:param name="pText"/>
<xsl:if test="normalize-space($pText)">
<xsl:value-of select="substring-before(concat($pText, '§'),'§')"/>
<xsl:if test="contains($pText, '§')">
<br/>
<xsl:call-template name="replace">
<xsl:with-param name="pText" select="substring-after($pText, '§')"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied on this source XML document (the originally-provided one with inserted ';' for line item and '§' for newline):
<research>Strategies and Approaches to Teaching and Learning Cross Cultures, Office for Learning and Teaching,
LOL - Grant (pre-2013), 2008 - 2052, §$90,000; Parkour strategies and parallel jumps for spatial data monitoring and join processing,
Right Wing Politics, JSA Early Career Artifact - Grant, 2004 - 20010, §$14,0000.
</research>
the wanted, correct result is produced:
<ul>
<li>Strategies and Approaches to Teaching and Learning Cross Cultures, Office for Learning and Teaching,
LOL - Grant (pre-2013), 2008 - 2052, <br />$90,000</li>
<li> Parkour strategies and parallel jumps for spatial data monitoring and join processing,
Right Wing Politics, JSA Early Career Artifact - Grant, 2004 - 20010, <br />$14,0000.
</li>
</ul>
and this is displayed by the browser as:
- Strategies and Approaches to Teaching and Learning Cross Cultures, Office for Learning and Teaching,
LOL - Grant (pre-2013), 2008 - 2052,
$90,000
- Parkour strategies and parallel jumps for spatial data monitoring and join processing,
Right Wing Politics, JSA Early Career Artifact - Grant, 2004 - 20010,
$14,0000.