Subject: RE: [xsl] Using translate() for single quotes in XSL1.0 From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sun, 27 Aug 2006 08:10:31 +0100 |
As I said, look in the FAQ under replace: http://www.dpawson.co.uk/xsl/sect2/replace.html Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Oleg Konovalov [mailto:olegkon@xxxxxxxxx] > Sent: 27 August 2006 03:37 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Cc: ythakare@xxxxxxxxxxx > Subject: Re: [xsl] Using translate() for single quotes in XSL1.0 > > Michael, > > I am trying to replace 1 single quote with 2 single quotes. > Should it work in template ? > > I do not have to option to upgrade to XSLT1.0 for many reasons. > > Thank you, > Oleg. > > > > On 8/25/06, Michael Kay <mike@xxxxxxxxxxxx> wrote: > > The translate() function does one-to-one replacement of > characters. To > > do anything else, use the replace() function in XSLT 2.0, > or look at > > the FAQ under "replace" to see how to do it under 1.0. > > > > Michael Kay > > http://www.saxonica.com/ > > > > > > > -----Original Message----- > > > From: Oleg Konovalov [mailto:olegkon@xxxxxxxxx] > > > Sent: 25 August 2006 21:12 > > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > > Cc: ythakare@xxxxxxxxxxx > > > Subject: [xsl] Using translate() for single quotes in XSL1.0 > > > > > > Hi, > > > > > > I am writing an XSL Transformer for SQL query and some of > the column > > > values ("ASSOCIATION_NAME") in DB might have a single > quote in the > > > name, which poses a problem in SQL. > > > > > > Example: > > > > > > <xsl:text> ... > > > (SELECT association_id > > > FROM ASSOCIATION > > > WHERE association_name='</xsl:text> > > > <xsl:value-of > > > select='$row/sht:Cell[sht:Name="ASSOCIATION_NAME"]/sht:Content > > > '/><xsl:text>' > > > ) )</xsl:text>... > > > > > > like: "MACY'S" > > > So I tried to use to replace 1 single quote in the column values > > > with > > > 2 single quotes > > > which SQL should resolve using translate(value, "'", "''"). > > > But there is such a mishmash of quotes and double quotes > that it's > > > impossible to resolve: > > > ... > > > <xsl:value-of select='translate( > > > $row/sht:Cell[sht:Name="ASSOCIATION_NAME"]/sht:Content, '"", > > > "'''")'/> > > > > > > Any way around it, maybe via ASCII of single quotes ? > > > > > > > > > Thank you in advance, > > > Oleg.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using translate() for sin, Oleg Konovalov | Thread | Re: [xsl] Using translate() for sin, Georg Hohmann |
Re: [xsl] Why no namespace node Kin, Colin Paul Adams | Date | RE: [xsl] Why no namespace node Kin, Michael Kay |
Month |