Jump to content

sorting xsl with asp variables


nurfnose

Recommended Posts

I have an asp form where a user can select their campus and class section. I want to use their answers (variables) in the xsl file to pull only those options from the xml file. Anybody have an idea of how to make this work? Here is my xsl file:

<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:template match="/">   <table cellpadding="5" cellspacing="0" border="1">	<thead>	 <tr>	  <th>Class</th>	  <th>Type</th>	  <th>Day</th>	  <th>Time</th>	  <th>Tutor</th>	  <th>Location</th>	 </tr>	</thead>	<tbody>	 <xsl:for-each select="schedule/course[@section='<% response.write(section) %>' and @campus='<% response.write(campus) %>']">	  <xsl:sort select="class" order="ascending"/>	   <tr>		<td><xsl:value-of select="class"/></td>		<td><xsl:value-of select="type"/></td>		<td><xsl:value-of select="day"/></td>		<td><xsl:value-of select="time"/></td>		<td><xsl:value-of select="tutor"/></td>		<td><xsl:value-of select="location"/></td>	   </tr>	 </xsl:for-each>	</tbody>   </table>  </xsl:template></xsl:stylesheet>

this is my asp file

<%dim campus, sectioncampus = request.form("campus")section = request.form("section")'Load XMLset xml = Server.CreateObject("Microsoft.XMLDOM")xml.async = falsexml.load(Server.MapPath("tutor.xml"))'Load XSLset xsl = Server.CreateObject("Microsoft.XMLDOM")xsl.async = falsexsl.load(Server.MapPath("tutor.xsl"))'Transform fileResponse.Write(xml.transformNode(xsl))%>

Link to comment
Share on other sites

You can pass parameters to the XSLT file, and then filter by them.I'm not sure how you do that with classic ASP though, and I seem to be unable to find the reference... here's in .NET... if that'd be of any help.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...