Jump to content

sorting xsl with asp variables

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))%>

  • Like 1
Link to post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...