RE: [xsl] Replacing double quotes with XSLT [faked-from][sls]

Subject: RE: [xsl] Replacing double quotes with XSLT [faked-from][sls]
From: Mischa Sandberg <MSandberg@xxxxxxxxxxxx>
Date: Mon, 22 Sep 2003 14:11:34 -0700
Ah yes, this one. It comes up whenever you use XSLT to generate SQL; and
I'll wager that's your problem, too. Your choices:

- Write a template (procedure) that does it. Painfully slow performance. The
code has been posted in many places; e.g.
    http://aspn.activestate.com/ASPN/Cookbook/XSLT/Recipe/65426

- use a script extension function (like msxml:) to use javascript's
REPLACE() method. MS-specific, and I think w3c is down on such extensions.

- do what we did: translate quote to an absurd character (take your pick)
and use SQL's replace() function internally.

- if you're NOT generating SQL, do a compiled pre- or post- process on the
text.

- wait until replace() is added to the standard.

-----Original Message-----
From: James Paul
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Sent: 22/09/2003 1:35 PM
Subject: [xsl] Replacing double quotes with XSLT [faked-from][sls]

I'm trying to replace " within a string in XSLT and replace it with ""
but I'm not having any luck.

Does NOT work

<xsl:element name = "OrganizationCode">
	<xsl:text>"</xsl:text>
	<xsl:value-of select =
"translate(../@OrganizationCode,'\"','\"\"'"/>
	<xsl:text>"</xsl:text>
</xsl:element>

Does NOT work

<xsl:element name = "OrganizationCode">
	<xsl:text>"</xsl:text>
	<xsl:value-of select =
"translate(../@OrganizationCode,'&#x22','&#x22&#x22'"/>
	<xsl:text>"</xsl:text>
</xsl:element>

Does anyone have any suggestions ???

Thanks

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread