Strings and apostrophies

Subject: Strings and apostrophies
From: Beat.Schaller@xxxxxxxx
Date: 26 Nov 1999 10:34:07 +0000
Hi all

I am new to this forum so if my question sounds not too smart please bear with me.
Using a freeware tool called DB2XML I extract data from our corporate Oracle database 
to a well-formed XML file. Using XSLT I then extract some data and create an Oracle PLSQL script to insert the data into other tables which works fine. There is one glitch 
however: Some of the data to insert contain apostropies eg "HANDY'S". Therefore the code my XSL produces is 

	INSERT into XYZ values ('1234', 'HAND'YS');

which SQL doesn't like at all.  

The desired output would be:

	INSERT into XYZ values ('HAND''YS') 	(note: two apostrophies !)

How do I go about it ? 


The code snippet to create the insert-clause is:

  <xsl:template match="record0">
    <xsl:if test="normalize(LEVEL_DESCR)='KATG'">
      insert into xyz
                  values (  '<xsl:value-of select="KATG_ID"/>'
                          , '<xsl:value-of select="KATG_DESCR"/>'
                         );
    </xsl:if>
  </xsl:template>

And a sample XML-record:

  <record0>
   <MMG_ART_MMG_ID>12428</MMG_ART_MMG_ID>
   <LEVEL_DESCR><![CDATA[KATG]]></LEVEL_DESCR>
   <MMG_ART_SEKT_ID>10003</MMG_ART_SEKT_ID>
   <SEKT_ID><![CDATA[S3]]></SEKT_ID>
   <SEKT_DESCR><![CDATA[FOOD]]></SEKT_DESCR>
   <MMG_ART_BEDA_ID>7</MMG_ART_BEDA_ID>
   <BEDA_ID><![CDATA[7]]></BEDA_ID>
   <BEDA_DESCR><![CDATA[FOOD]]></BEDA_DESCR>
   <MMG_ART_RAYO_ID>75</MMG_ART_RAYO_ID>
   <RAYO_ID><![CDATA[75]]></RAYO_ID>
   <RAYO_DESCR><![CDATA[FLEISCH]]></RAYO_DESCR>
   <MMG_ART_WARG_ID>750</MMG_ART_WARG_ID>
   <WARG_ID><![CDATA[750]]></WARG_ID>
   <WARG_DESCR><![CDATA[FLEISCH]]></WARG_DESCR>
   <MMG_ART_KATG_ID>12428</MMG_ART_KATG_ID>
   <KATG_ID><![CDATA[7545]]></KATG_ID>
   <KATG_DESCR><![CDATA[PFERD]]></KATG_DESCR>
  </record0>


Any help is greatly appreciated.

Beat


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


Current Thread