こんにちは、XML で以下の行があり、番号のハイパーリンクも必要です。この出力を HTML 形式で表示したい。
<main>
<alph>a b 2,3</alph>
</main>
次のような出力を与える XSLT が必要です。
a b 2, a b 3
以下の XSLT を試しました。
<xsl:template match="alph">
<xsl:variable name="link" select="normalize-space(translate(
normalize-space(current()),abcdefghijklmnopqrstuvwxyz,''))"/>
<xsl:value-of select="substring-before(normalize-space(.),$link)"/>
<xsl:variable name="tex">
<xsl:value-of select="text()"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($link,',')">
<xsl:variable name="new">
<xsl:value-of select="tokenize($link,',')"/>
</xsl:variable>
<xsl:value-of select="concat($new,$tex)"/>
</xsl:when>
<xsl:when test="contains($link,'-')">
<xsl:value-of select="tokenize($link,'-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$link"/>
</xsl:otherwise>
</xsl:choose>
しかし、それは私に次のような出力を与えています:
a b 2 3a b 2,3
ありがとう