Subject: RE: [xsl] additional question: FO subscript Revisited From: "Tanzila Mohammad" <tmohammad@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 21 Nov 2001 12:54:07 -0000 |
Thanks Jeni. The list of characters may get larger and larger over time. Tanzila -----Original Message----- From: Jeni Tennison [mailto:jeni@xxxxxxxxxxxxxxxx] Sent: 21 November 2001 12:32 To: Tanzila Mohammad Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] additional question: FO subscript Revisited Hi Tanzila, > Just a question, I have used the code but I am trying to manipulate > it so that as well as a 2 it subscripts a 5. But this time the row > information is duplicated - any suggestions? The reason it's duplicating the information is that you're doing two things with the same string at the same time - first substituting the 2 and then substituting the 5. The two choices need to be separate. Also, you need to make sure that you call the template on the substring *before* the 2, just in case it contains a 5: <xsl:template name="replace2s"> <xsl:param name="string" select="string()" /> <xsl:variable name="subscript2"> <fo:inline baseline-shift="sub" font-size="6px">2</fo:inline> </xsl:variable> <xsl:variable name="subscript5"> <fo:inline baseline-shift="sub" font-size="6px">5</fo:inline> </xsl:variable> <xsl:choose> <xsl:when test="contains($string, '2')"> <xsl:call-template name="replace2s"> <xsl:with-param name="string" select="substring-before($string, '2')" /> </xsl:call-template> <xsl:copy-of select="$subscript2" /> <xsl:call-template name="replace2s"> <xsl:with-param name="string" select="substring-after($string, '2')" /> </xsl:call-template> </xsl:when> <xsl:when test="contains($string, '5')"> <xsl:value-of select="substring-before($string, '5')" /> <xsl:copy-of select="$subscript5" /> <xsl:call-template name="replace2s"> <xsl:with-param name="string" select="substring-after($string, '5')" /> </xsl:call-template> </xsl:when> <xsl:otherwise><xsl:value-of select="$string" /></xsl:otherwise> </xsl:choose> </xsl:template> If you keep adding things to the list of characters that need to be replaced, then you'd be better off with a different approach, so let us know if that's the case. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] additional question: FO s, Jeni Tennison | Thread | Re: [xsl] additional question: FO s, Jeni Tennison |
Re: [xsl] additional question: FO s, Jeni Tennison | Date | Re: [xsl] additional question: FO s, Jeni Tennison |
Month |