473,809 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replacing a single quote with 2 single quotes in XSL

1 New Member
The @name field can contain a single quote in it such as: Mike O'Grady.
Since this is creating and SQL statement on the server side, it will not process the name if it has a single quote in it. Id' like to replace that single quote with 2 single quotes without destroying th rest of th data in the field. Currently I replace a single quote with a "^" and then do a replace of that on the server side, see last <zz>. That statement is ecexuted on the other side. Please help, if there is help......Don.
Here;s the crude XSL doc:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2.  <!-- ******************************************************************** -->
  3.  <!-- * This XSL is used to transform the mampcp document to * -->
  4.  <!-- * SQL script that will insert the decomposed data to our mampcpwrk file * -->
  5.  <!-- * table. * -->
  6.  <!-- ******************************************************************** -->
  7.  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
  8.     xmlns:php="http://php.net/xsl">
  9.     <xsl:output method="text" indent = "no" encoding="UTF-8"/>
  10.     <!-- Process complete tree starting from root-->
  11.     <xsl:template match="pccList">
  12.    <!-- Process each repeating MEMBER-INFO -->
  13.     <xsl:variable name="old">'</xsl:variable>
  14.     <xsl:variable name="new">^</xsl:variable>
  15.       <xsl:for-each select="pcc">
  16.     insert into  mampcpwrk (name,prcode,wrkph2,adrln1,zipcod,zipcod4,titlcd,
  17.      provno,wrkph1,adrln2,citycd,stacod) 
  18.     values (&apos;<xsl:value-of                                                 select="translate(@name,$old,$new)"/>&apos;,
  19.     &apos;<xsl:value-of select="translate(@cde_service_loc,$old,$new)"/>&apos;,
  20.     &apos;<xsl:value-of select="translate(@num_phone,$old,$new)"/>&apos;,
  21.     &apos;<xsl:value-of select="translate(@adr_mail_strt1,$old,$new)"/>&apos;,
  22.     &apos;<xsl:value-of select="translate(@adr_mail_zip,$old,$new)"/>&apos;,
  23.     &apos;<xsl:value-of select="translate(@adr_mail_zip_4,$old,$new)"/>&apos;,
  24.     &apos;<xsl:value-of select="translate(@nam_title,$old,$new)"/>&apos;,
  25.     &apos;<xsl:value-of select="translate(@id_provider,$old,$new)"/>&apos;,
  26.     &apos;<xsl:value-of select="translate(@num_area_code,$old,$new)"/>&apos;,
  27.     &apos;<xsl:value-of select="translate(@adr_mail_strt2,$old,$new)"/>&apos;,
  28.     &apos;<xsl:value-of select="translate(@adr_mail_city,$old,$new)"/>&apos;,
  29.     &apos;<xsl:value-of select="translate(@adr_mail_state,$old,$new)"/>&apos;);
  30.      </xsl:for-each> 
  31.      <zz>update mampcpwrk set name=replace(name,&apos;^&apos;,&apos;&apos;&apos;&apos;);</zz>
  32.     </xsl:template>
  33.  </xsl:stylesheet>
Dec 20 '07 #1
0 2203

Sign in to post your reply or Sign up for a free account.

Similar topics

11
36189
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into a javascript function called by onClick. The problem is that the text may contain single or double quotes, which screws up the javascript. I eliminated the single quote problem by running the text through addslashes, but the double quotes are a...
4
10640
by: sankofa | last post by:
hi, i can't seem to be able to escape my single quote properly... is it even possible in javascript? this is a portion of my code.. var DLEWIS="Pastor Lewis"; .... Sermon is a yser-defined class .. var en_20031102=new Sermon("11/02",DLEWIS,"The Lord\'s Supper: The Art Of
5
11460
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. Queston: How do you handle a string that contains both single & double quotes (i.e. 12'X7") Here's the function:
4
31240
by: Greg | last post by:
I keep getting an error when I have a tick mark in a text value that I am searching for in my XPath Query. Example: <Authors> <Author LastName="O'Donnel"> <Author LastName="Smith"> </Authors>
1
1510
by: asd987 | last post by:
Hi, Ihave to print a field (type memo) to a file. I know how to do that ;-), but there's one complication: all single quotes (') in the record must be replaced by <backslash> + <single quote> (\') before (or during) printing to the file. How do I do this? Thanks.
7
21037
by: gar | last post by:
Hi, I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code text= Replace(text, """", "'" This works fine (for normal double quotes).The problem comes in when you copy a double quote from MS Word and paste it in the text box. What happens is the double quote becomes slanted (“) so my code above can't filter it. I tried to do this text= Replace(text, "““","'")
4
7477
by: Justin Fancy | last post by:
Hi everyone, I need to replace all instances of a double quote(") with two single quotes('') in a text file. I already have some replacements of strings going on, but I tried this one, but the syntax is being read wrong. Here is the code: lineFile1 = sr.ReadLine
2
2888
by: Reporter | last post by:
I got the following example from http://www.evolt.org/article/User_Friendly_Forms_in_PHP/20/60144/index.html : echo '<tr><td>First name:</td><td><input type="text" name="first_name" value="'.htmlspecialchars($_POST).'"></td></tr>'; What purpose do the single quotes serve in value="'.htmlspecialchars($_POST).'" I don't mean the single quotes around first_name. I mean the single
5
1247
by: samslists | last post by:
Hi... Here's a weird problem...I'm trying to escape a bunch of data to put into a database. Here's what I have: def escape(string): """ Escape both single quotes and blackslashes
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7662
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.