Subject: Re: translate quot to apos From: "Andrea Penna" <andreapenna@xxxxxxxxx> Date: Wed, 23 Aug 2000 13:33:51 +0200 |
Similar problem here: I have to change all "quote" and "apos" before use the string as a javascript-function argument. So I need to change every "apos" to "\apos" or to "apos apos" and the same with "quote" too. But if I'm not wrong the translate function can substitute one character with only another one and not with two or more: "If the third argument string is longer than the second argument string, then excess characters are ignored" (from http://zvon.org/xxl/XSLTreference/Output/index.html site). Also if I use variables. How to solve this? This is the piece of my xsl file (not working because replacing ' with ' and not with ''): <xsl:variable name="apos">'</xsl:variable> <xsl:variable name="apos2">''</xsl:variable> <xsl:variable name="quote">"</xsl:variable> <xsl:variable name="quote2">""</xsl:variable> <xsl:variable name="Abstract1" select="normalize-space(.)"/> <xsl:variable name="Abstract2" select="translate($Abstract1,$apos,$apos2)"/> <xsl:variable name="Abstract3" select="translate($Abstract2,$quote,$quote2)"/> <xsl:attribute name="onclick">NewWindow('<xsl:value-of select="$Abstract3"/>')</xsl:attribute> Thank you, Andrea > Best way is to use variables: > > <xsl:variable name="quot">"</xsl:variable> > <xsl:variable name="apos">'</xsl:variable> > <xsl:value-of select="translate(Tag1, $quot, $apos)"/> > > Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: name() and attribute(), Lee Goddard | Thread | RE: translate quot to apos, Pawson, David |
name() and attribute(), Lee Goddard | Date | Re: Need some help with an expressi, David Allouche |
Month |