[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xslt replace special characters

Subject: Re: xslt replace special characters
From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Nov 2002 13:00:46 -0700
javascript convert special characters
Alice,

This is going way off-topic, but...

You still haven't described the environment of the UI, so I'll assume it's an HTML page. If so, use a simple JavaScript function to replace all occurrences of '&' with '&amp;' in your textfield value prior to the form's submission.

<script type="text/javascript">

function mySubmit()
  {
  document.true_url.value = convert(document.url.value);
  document.myform.action = "real form url here";
  document.myform.submit();
  // 'true_url' will have the "encoded" url value.
  } // ends mySubmit(void)

function convert(url)
  {
  var re = /&/g;
  return url.replace(re, "&amp;");
  } // ends convert(String)

</script>
...
<form name="myform" action="javascript:;" method="post">
  <input type="text" name="url" value="" />
  <input type="hidden" name="true_url" value="" />
  <input type="button" value="Submit" onclick="mySubmit();" />
</form>

Greg

At 12:36 PM 11/11/2002, you wrote:
Thanks Greg. Right in the UI, we want the user to enter their URL. Their URL will most likely have name/value pairs. Is there an easier way? There is no otherway of filtering '&' before it gets processed in the XSL?

Alice



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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.