XSLT を介して XML データを使用してスライドショーを作成中です。プロセスの一部は、タイトルで配列を初期化しています。
item[0] = ["How do I jump?"];
item[1] = ["I know how to jump!"];
item[2] = ["Did you read "how to jump""];
3 番目の要素の本のタイトルが二重引用符で囲まれていることに注意してください。その要素を初期化すると、スタイルシートのコンパイルで問題が発生します (そうあるべきです) が、二重引用符を削除して単一引用符に置き換える方法はありますか?
<xsl:variable name="apos"><xsl:text>'</xsl:text></xsl:variable>
<xsl:variable name="double_quote"><xsl:text>"</xsl:text></xsl:variable>
<xsl:for-each select="/data/calendar/event/title">
<xsl:variable name="index">
<xsl:value-of select="position() - 1"/>
</xsl:variable>
<xsl:variable name="safeTitle" select="translate(text(),$double_quote, $apos)" /><!-- prevents double quotes from being used inside an array using double quotes -->
fadetitlesSS12<xsl:value-of select="/data/calendar/id" />[<xsl:value-of select="$index" />]=["<xsl:value-of select="$safeTitle" />"];
</xsl:for-each>