| Subject: RE: [xsl] ASP in XSL ? (Need URL Encoding) From: "Chris Bayes" <Chris@xxxxxxxxxxx> Date: Thu, 19 Apr 2001 11:25:48 +0100 | 
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 | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] ASP in XSL ? (Need URL En, Michael Kay | Thread | [xsl] problem with xsl:variable and, Mandar Ogale | 
| RE: [xsl] copy-of question, Michael Kay | Date | RE: [xsl] cooktop-tips, Chris Bayes | 
| Month |