I'm writing a simple asp page to show a team rota based on some XML. Here's the XML:
<rota>
<shift date="20091201" primary="Chan" secondary="John" notes="notes"></shift>
<shift date="20091202" primary="Mike" secondary="Alex" notes="notes"></shift>
<shift date="20091203" primary="Ross" secondary="Mike" notes="notes"></shift>
<shift date="20091204" primary="Neil" secondary="Ross" notes="notes"></shift>
</rota>
I want my asp page to show today's rota details and maybe the details for the next couple of days. Since later on I'd like to be able to set a day in the future to see who's working around then I want to be able to pass a YYYYMMDD date from the ASP to the XSL that processes the XML.
Here's the XSL I have so far, just highlighting the hardcoded 'current' date for now:
<xsl:template match="rota">
<html>
<head>
<title>Team Rota</title>
<LINK type="text/css" rel="stylesheet" href="http://www.csfb.net/homepage/global/scripts/csfb_intranet.css"/>
</head>
<body>
<table border="1">
<TR><TH>Date</TH><TH>Primary</TH><TH>Secondary</TH><TH>Notes</TH></TR>
<xsl:for-each select="shift">
<tr>
<xsl:choose>
<xsl:when test="@date = '20091203'">
<td bgcolor='FFF0F0'><xsl:value-of select="@date"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="@date"/></td>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="@primary"/></td>
<td><xsl:value-of select="@secondary"/></td>
<td><xsl:value-of select="@notes"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
and here's the ASP, not yet passing any parameters:
''// Load the XML
sourcefile = "rota.xml"
set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.load(sourceFile)
''// Load the XSL
styleFile = Server.MapPath("rota.xsl")
set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = false
style.load(styleFile)
htmltext = source.transformNode(style)
Response.Write htmltext
So how do I a) pass a parameter to the XSL and b) pick up that parameter and use it in the XSL?
Thanks for any guidance.