errorLog
要素を制御できる場合は、そこでリテラル LF 文字を使用することもできます。XSLT に関する限り、他の文字と何ら変わりはありません。
改行で表示される HTML を作成する<br/>
場合は、XML ソースにあるマーカーの代わりに要素を追加する必要があります。このように、各エラーを個別の要素内に配置できれば、最も簡単です。
<errorLog>
<error>error1</error>
<error>error2</error>
<error>error3</error>
</errorLog>
そうすれば、XSLT は、テキスト自体を分割するというかなり厄介なプロセスを経る必要がなくなります。
あなたの質問から取得したこのXMLデータを使用して
<document>
<bunch-of-other-things/>
<bunch-of-other-things/>
<errorLog>error1 \n error2 \n error3</errorLog>
</document>
このスタイルシート
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:template match="/document">
<html>
<head>
<title>Error Log</title>
</head>
<body>
<xsl:apply-templates select="*"/>
</body>
</html>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="errorLog">
<p>
<xsl:call-template name="split-on-newline">
<xsl:with-param name="string" select="."/>
</xsl:call-template>
</p>
</xsl:template>
<xsl:template name="split-on-newline">
<xsl:param name="string"/>
<xsl:choose>
<xsl:when test="contains($string, '\n')">
<xsl:value-of select="substring-before($string, '\n')"/>
<br/>
<xsl:call-template name="split-on-newline">
<xsl:with-param name="string" select="substring-after($string, '\n')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
<br/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
この出力が生成されます
<html>
<head>
<title>Error Log</title>
</head>
<body>
<bunch-of-other-things/>
<bunch-of-other-things/>
<p>error1 <br/> error2 <br/> error3<br/>
</p>
</body>
</html>