Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

order-by attribute in XML

Status
Not open for further replies.

MarkJ2

Technical User
Sep 25, 2001
17
US
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 = &quot;sort(xmldoc)&quot;>

<XML ID = &quot;xmlData1&quot; SRC = &quot;..\Xml\Project.xml&quot;></XML>

<XML ID = &quot;xmlSortAuthorsAscending&quot;>
<CSCATALOG>
<xsl:for-each order-by = &quot;+AUTHOR&quot; select = &quot;CSCATALOG/RECORD&quot;
xmlns:xsl = &quot; <RECORD>
<AUTHOR><xsl:value-of select = &quot;AUTHOR&quot;/></AUTHOR>
<TITLE><xsl:value-of select = &quot;TITLE&quot;/></TITLE>
<CALLNUM><xsl:value-of select = &quot;CALLNUM&quot;/></CALLNUM>
<LOCATIONS><xsl:value-of select = &quot;LOCATIONS&quot;/></LOCATIONS>
<STATUS><xsl:value-of select = &quot;STATUS&quot;/></STATUS>
</RECORD>
</xsl:for-each>
</CSCATALOG>
</XML>


<SCRIPT LANGUAGE = &quot;JavaScript&quot;>


var xmldoc = xmlSortAuthorsAscending.XMLDocument;

function sort ( xmldoc ) {
xmldoc.documentElement.transformNodeToObject( xmlData1.XMLDocument );
}
</SCRIPT>

<TABLE DATASRC = &quot;#xmlData1&quot;>
<THEAD>
<TR>
<TH>Author</TH>
<TH>Title</TH>
<TH>Call Number</TH>
<TH>Location</TH>
<TH>Status</TH>
</TR>
</THEAD>

<TR>
<TD><SPAN DATAFLD = &quot;AUTHOR&quot;></SPAN></TD>
<TD><SPAN DATAFLD = &quot;TITLE&quot;></SPAN></TD>
<TD><SPAN DATAFLD = &quot;CALLNUM&quot;></SPAN></TD>
<TD><SPAN DATAFLD = &quot;LOCATIONS&quot;></SPAN></TD>
<TD><SPAN DATAFLD = &quot;STATUS&quot;></SPAN></TD>
</TR>
</TABLE>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top