[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: XML/XSL and ASP/IIS


Subject: RE: XML/XSL and ASP/IIS
From: "Jonathan Borden" <jborden@xxxxxxxxxxxx>
Date: Sat, 5 Jun 1999 13:17:44 -0400

Mapping the .xsl extension to asp.dll seems confusing to me. What you are
attempting to do is to pass parameters to the XSL stylesheet. The most
efficient way to do this is to pass parameters as top level attributes of
the XML document itself e.g.:

	objXML.setAttribute("color","red");
	objXML.setAttribute("language","italian");
	var str = objXML.transformNode(objXSL);

This allows the client to cache the XSL stylesheet, eliminates the overhead
of server processing and eliminates the network roundtrip associated with
the transformation.

You can use XSL conditionals such as
<xsl:if test=".[@color = 'red']">
or
<xsl:choose><xsl:when test="/*[@language='italian']">

to do this.

Using XSL and client side transformation, I have been able to greatly reduce
the need to use ASP, saving this for appropriate uses such as database
access/updates and other transactions.

Jonathan Borden
http://jabr.ne.mediaone.net


>
> Hi there - well, I've tried this with half success/half failure.
>
> I I run the file below, low.xsl, directly from a web page, and
> after having
> mapped it's MIME type to the asp.dll, then I can do everything as I
> expected.
>
> However, when I use the following in my asp page,
>
>     strOutput = objXML.transformNode(objXSL)
>
> I am unable to get any response back in strOutput. I don't know what the
> problem is as I would still expect the .xsl file to be parsed by
> asp.dll and
> the resuting page to be returned - as soon as I take the ASP stuuf out of
> the low.xsl file, everything works using strOutput =
> objXML.transformNode(objXSL).
>
> What am I doing wrong, or is there a better/another way to do this?
>
> Thanks
> Steven
>
> "low.xsl"
> ====================================================
> <?xml version="1.0"?>
> <HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> <LINK REL="stylesheet" TYPE="text/css" HREF="english.css" />
>   <BODY STYLE="font-family:Arial, helvetica, sans-serif; font-size:10pt;
> background-color:#EEEEEE">
> <%If Request.QueryString("color")="red" Then%>
>       <DIV STYLE="background-color:red; color:white; padding:4px">
> <%Else%>
>  <DIV STYLE="background-color:teal; color:white; padding:4px">
> <%End If%>
>         <SPAN STYLE="font-weight:bold; color:white">
>    <xsl:value-of select="document/title"/> by
>    <xsl:value-of select="document/author"/></SPAN>
>       </DIV>
>       <DIV class="english" STYLE="background-color:darkblue; color:white;
> padding:4px">
>         <SPAN STYLE="font-weight:bold; color:white;">
>    <xsl:value-of select="document/abstract/English"/>
>   </SPAN>
>       </DIV>
>       <DIV class="italian" STYLE="background-color:darkblue; color:white;
> padding:4px">
>         <SPAN STYLE="font-weight:bold; color:white;">
>    <xsl:value-of select="document/abstract/Italian"/>
>   </SPAN>
>       </DIV>
>   </BODY>
> </HTML>


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



Current Thread
Keywords