I wrote a script that when the page is loaded a function is called that sorts some data. The data is linked by an 'ID'.
In the xsl statements, I have an order-by = "+AUTHOR".
AUTHOR is the name of a element in my xml document.
I then display the sorted info. in a HTML table.
When I open the page in my browser, the info. displays in the table, however it is not sorted by the element (AUTHOR)
I have assigned to the order-by attribute.
I have copied the code below....if anyone can tell me where the error lies I would appreciate it.
Thanks (code below)
<BODY ONLOAD = "sort(xmldoc)">
<XML ID = "xmlData1" SRC = "..\Xml\Project.xml"></XML>
<XML ID = "xmlSortAuthorsAscending">
<CSCATALOG>
<xsl:for-each order-by = "+AUTHOR" select = "CSCATALOG/RECORD"
xmlns:xsl = " <RECORD>
<AUTHOR><xsl:value-of select = "AUTHOR"/></AUTHOR>
<TITLE><xsl:value-of select = "TITLE"/></TITLE>
<CALLNUM><xsl:value-of select = "CALLNUM"/></CALLNUM>
<LOCATIONS><xsl:value-of select = "LOCATIONS"/></LOCATIONS>
<STATUS><xsl:value-of select = "STATUS"/></STATUS>
</RECORD>
</xsl:for-each>
</CSCATALOG>
</XML>
<SCRIPT LANGUAGE = "JavaScript">
var xmldoc = xmlSortAuthorsAscending.XMLDocument;
function sort ( xmldoc ) {
xmldoc.documentElement.transformNodeToObject( xmlData1.XMLDocument );
}
</SCRIPT>
<TABLE DATASRC = "#xmlData1">
<THEAD>
<TR>
<TH>Author</TH>
<TH>Title</TH>
<TH>Call Number</TH>
<TH>Location</TH>
<TH>Status</TH>
</TR>
</THEAD>
<TR>
<TD><SPAN DATAFLD = "AUTHOR"></SPAN></TD>
<TD><SPAN DATAFLD = "TITLE"></SPAN></TD>
<TD><SPAN DATAFLD = "CALLNUM"></SPAN></TD>
<TD><SPAN DATAFLD = "LOCATIONS"></SPAN></TD>
<TD><SPAN DATAFLD = "STATUS"></SPAN></TD>
</TR>
</TABLE>
</BODY>
</HTML>
In the xsl statements, I have an order-by = "+AUTHOR".
AUTHOR is the name of a element in my xml document.
I then display the sorted info. in a HTML table.
When I open the page in my browser, the info. displays in the table, however it is not sorted by the element (AUTHOR)
I have assigned to the order-by attribute.
I have copied the code below....if anyone can tell me where the error lies I would appreciate it.
Thanks (code below)
<BODY ONLOAD = "sort(xmldoc)">
<XML ID = "xmlData1" SRC = "..\Xml\Project.xml"></XML>
<XML ID = "xmlSortAuthorsAscending">
<CSCATALOG>
<xsl:for-each order-by = "+AUTHOR" select = "CSCATALOG/RECORD"
xmlns:xsl = " <RECORD>
<AUTHOR><xsl:value-of select = "AUTHOR"/></AUTHOR>
<TITLE><xsl:value-of select = "TITLE"/></TITLE>
<CALLNUM><xsl:value-of select = "CALLNUM"/></CALLNUM>
<LOCATIONS><xsl:value-of select = "LOCATIONS"/></LOCATIONS>
<STATUS><xsl:value-of select = "STATUS"/></STATUS>
</RECORD>
</xsl:for-each>
</CSCATALOG>
</XML>
<SCRIPT LANGUAGE = "JavaScript">
var xmldoc = xmlSortAuthorsAscending.XMLDocument;
function sort ( xmldoc ) {
xmldoc.documentElement.transformNodeToObject( xmlData1.XMLDocument );
}
</SCRIPT>
<TABLE DATASRC = "#xmlData1">
<THEAD>
<TR>
<TH>Author</TH>
<TH>Title</TH>
<TH>Call Number</TH>
<TH>Location</TH>
<TH>Status</TH>
</TR>
</THEAD>
<TR>
<TD><SPAN DATAFLD = "AUTHOR"></SPAN></TD>
<TD><SPAN DATAFLD = "TITLE"></SPAN></TD>
<TD><SPAN DATAFLD = "CALLNUM"></SPAN></TD>
<TD><SPAN DATAFLD = "LOCATIONS"></SPAN></TD>
<TD><SPAN DATAFLD = "STATUS"></SPAN></TD>
</TR>
</TABLE>
</BODY>
</HTML>