Following is a cut from my htm that includes a reference to the table header and "tablebody" div tag which builds my dhtml table with a call to a
js function from the body tag load function:
<div id="centerDoc">
<div>
<span><b>Selection</b></span>
</div>
<DIV id="tableHeader">
<TABLE width="625" border="1" cellspacing="0">
<TR>
<TH width="200" onClick="sort('./ID','text');">Test Name</TH>
<TH width="150" onClick="sort('./ISO8601','text');">Test Date</TH>
<TH width="75" onClick="sort('./Status','text');">Status</TH>
<TH width="200" >Report Type</TH>
</TR>
</TABLE>
</DIV>
<DIV id="tableBody" style="width:625px;height:110px;overflow:scroll;"> </DIV>
<XML id="replace" src="test.xsl"></XML>
<XML id="tableXSL" src="20040903T170000_ICO_testselectiontable.xsl"></XML>
<XML id="XMLdata" src="20040903T170000_ICO_testselectiontable.xml"></XML>
</div>
<div id="displayReport">
<XML id="replaceTable" src="test.xsl"></XML>
</div>
This works great. Now, when the user clicks in a row I want to transform just that node using a different xsl and display that contents in the tableBody tag. Following is a cut from my xsl that builds the body of the above table:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="testnumber" select="1" />
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<TABLE width="625" border="1" cellspacing="0" bgcolor="white">
<xsl:for-each select="//Test">
<xsl:sort select="./ID" order="ascending" data-type="text" case-order="lower-first"/>
<TR id="trnode">
<xsl:attribute name="onclick">selectRow(this)</xsl:attribute>
<xsl:attribute name="ondblclick">selectRow(this);selectTestCurren tRow()</xsl:attribute>
<TD id="idCol" width="200">
<a href="{./ID/@value}" ><xsl:value-of select="./ID"/></a>
</TD>
Also, the
js method I want to use to do the transformation with just the selected node and the xsl named "replace" mentioned above.
function selectTestCurrentRow()
{
XMLIsland = document.all.XMLdata.XMLDocument;
node = XMLIsland.selectSingleNode("//Test[ID='" + currentRow.childNodes(0).innerText + "']").xml;
alert(node)
newHTML = XMLIsland .transformNode(document.all.replace.XMLDocument);
document.getElementById('centerDoc').innerHTML = "";
document.getElementById('displayReport').innerHTML = newHTML;
}
This works fine up to the alert(). I can display the selected node in the alert but have no idea how to do the transform of the single node with the second style sheet and display it in the bodytag. Boy, I hope I'm making sense :-) I must say tho...I find this XML / XSL thing very interesting. Can someone push me through this? I get a weird error at the transform line that says the stylesheet does not contain a document element? Also, I select the single node so shouldn't I pass that for the transform and not the entire island?