RE: [xsl] ASP in XSL ? (Need URL Encoding)

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

>  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
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;
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;

in your xslt do this

<xsl:stylesheet xmlns:xsl="";

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");
...<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

 XSL-List info and archive:

Current Thread