I am creating slide shows using XML data through XSLT. Part of the process initializes the array with the header:
item[0] = ["How do I jump?"];
item[1] = ["I know how to jump!"];
item[2] = ["Did you read "how to jump""];
Please note that the third element has the name of the book in double quotes? Well, initializing this element leads to problems with compiling the stylesheet (as it should be), but is there a way around the double quotes and replacing them with single quotes?
<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)" />
fadetitlesSS12<xsl:value-of select="/data/calendar/id" />[<xsl:value-of select="$index" />]=["<xsl:value-of select="$safeTitle" />"];
</xsl:for-each>
Minja source
share