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

RE: ASP in XSL ? (Need URL Encoding)

Subject: RE: ASP in XSL ? (Need URL Encoding)
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Thu, 19 Apr 2001 11:25:48 +0100
xsl server.urlencode
Serdar,

>  Using MSXML3 I'm doing a server side transformation using XSL. This may
>seem like a silly question but I really need to use the Server.URLEncode
>function of ASP to encode my href's, but it's not working (error:object
>required).
It shouldn't matter if your output method is HTML it will do it for you. But
if it doesn't or you want to have your output method as XML...
In your asp do this

var tem = new ActiveXObject("MSXML2.XSLTemplate");
var xsl = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
xsl.async = false;
xsl.load("some.xslt");
tem.stylesheet = xsl;
var proc = tem.createProcessor();

var myObject = new Object();
myObject.urlencode = function(par){return Server.URLEncode(par);};
proc.addObject(myObject, "urn:Serdar-urlencode");
proc.input = xml;
proc.transform();

in your xslt do this

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
	xmlns:SerdarFuncs="urn:Serdar-urlencode">

then at some point do this

<xsl:value-of select="SerdarFuncs:urlencode(string(@href))" />

I suppose you could do this
proc.addObject(Server, "urn:Server");
then
...<xsl:value-of select="Server:URLEncode(string(@href))" />
and even
proc.addObject(Request, "urn:Request");
...<xsl:value-of select="Request:Item(string('some form field').value)" />
but I haven't tried it

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


 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-2011 All Rights Reserved.