Hi there,
I'm having a big problem trying to pass a "selected" variable from a html table to a xsl file for filtering off records.
My html table is constructed using javacript to import a xml file, and then styled using javascript to detect mouse click and hover events and thus assign classes to each table row.
I.e.
These functions are an example of how the table is styled. I would like to (upon clicking on a button entitled "edit applicant") to load my applicants.xml which is styled by my applicants.xsl:
However I can't seem to figure out how to pass the javascript variable from the current html/javscript file to my applicants.xsl/xml document so I can use it in my <xsl if> statement.
As you can probably tell by now - i'm aiming to select a table row with my mouse and then click my edit applicant link, which will then in turn only load up a table of the selected record for me to edit.
I appreciate this is quite a long post so I thank you for reading it - any advice you can give me would be most welcome, as being a bit new to all this, I'm going bonkers...
Regards,
Sykth.
I'm having a big problem trying to pass a "selected" variable from a html table to a xsl file for filtering off records.
My html table is constructed using javacript to import a xml file, and then styled using javascript to detect mouse click and hover events and thus assign classes to each table row.
I.e.
Code:
function selectRow(evt) {
evt = (evt) ? evt : window.event;
var newRow = (evt.target) ? evt.target : evt.srcElement;
newRow = newRow.parentNode;
//reset event handlers for row being unselected
selectedRow.onmousedown = selectRow;
selectedRow.onmouseout = unhighliteRow;
selectedRow.onmouseover = highliteRow;
//erase event handlers for selected row
newRow.onmousedown = '';
newRow.onmouseout = '';
newRow.onmouseover = '';
//reset the row's color
if (parseInt(selectedRow.id) % 2 == 0) {
selectedRow.className = 'even';
} else {
selectedRow.className = 'odd';
}
newRow.className = "selected"; //select the row by changing its class
selectedRow = newRow;
function highliteRow(evt) {
evt = (evt) ? evt : window.event;
var evtRow = (evt.target) ? evt.target : evt.srcElement;
evtRow = evtRow.parentNode;
evtRow.className = "highlited"; //highlite the row by changing its
//class
}
}
These functions are an example of how the table is styled. I would like to (upon clicking on a button entitled "edit applicant") to load my applicants.xml which is styled by my applicants.xsl:
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" (board didnt like my xsl link)
<xsl:template match="/">
<html>
<head>
</head>
<body>
<form method="post" action="EditApplicant.asp">
<h1>Edit Contact:</h1>
<table border="1" cellpadding="2">
<xsl:for-each select="applicants/applicant/*">
<xsl:if test="newRow.className ='selected'">
<tr>
<td>
<xsl:value-of select="@id"/>
</td>
<td>
<input type="text"> <xsl:attribute name="id"> <xsl:value-of select="@id" /> </xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute> <xsl:attribute name="value"> <xsl:value-of select="text()" /> </xsl:attribute></input>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
<input type="submit" id="btnSubmit" name="btnSubmit" value="Submit" />
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
However I can't seem to figure out how to pass the javascript variable from the current html/javscript file to my applicants.xsl/xml document so I can use it in my <xsl if> statement.
As you can probably tell by now - i'm aiming to select a table row with my mouse and then click my edit applicant link, which will then in turn only load up a table of the selected record for me to edit.
I appreciate this is quite a long post so I thank you for reading it - any advice you can give me would be most welcome, as being a bit new to all this, I'm going bonkers...
Regards,
Sykth.