This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: multiple sorting


	I was trying to use Jeni's technique to use xsl:sort instead 
	of the order-by ,

	      < file1.xsl  >
		<?xml version="1.0"?>
		<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
		<xsl:param name="sortkey" select="'NAME'"/> /// default
	      <xsl:for-each select="RECORD">
	      <xsl:sort select="*[name()=$sortkey]"/>

	    /// call from script 
	   <SCRIPT FOR="window" EVENT="onload">
	   	   xslTarget.innerHTML =
source.transformNode(style.XMLDocument);
	   	   sortField =
style.XMLDocument.selectSingleNode("//xsl:param");

	   </SCRIPT>
	   <SCRIPT language='vbscript'>
	        function sort(field)
		         sortField.setAttribute "select","'"+ field +"'"
		         xslTarget.innerHTML =
source.transformNode(style.XMLDocument)
			end function
	   </SCRIPT>

	   This works fine but I had a problem trying to assign value's
directly to the <<xsl:sort>> node 
	         something like this  

	         file1.xsl
	
------------------------------------------------------------------------- 
	   	   sortField =
style.XMLDocument.selectSingleNode("//xsl:sort");

	         file1.html
	
------------------------------------------------------------------------- 
	         sortField.setAttribute "select","'"+ field +"'"

		 In this case I dont really see the xsl:param node to be any
different from the xsl:sort node.
		 my question is 
		what is so special about the xsl:sort node ???? why does it
act differently ??????????????????????

	Thanks
	Srini		









	 -----Original Message-----
	From: Joshua Allen [mailto:joshuaa@microsoft.com]
	Sent: Tuesday, August 15, 2000 11:20 AM
	To: 'xsl-list@mulberrytech.com'
	Cc: 'Yuko_Caras@Visioncompass.com'
	Subject: RE: multiple sorting


	Sorting dynamically client-side really implies that
	your browser supports XML (which means IE today) and
	if you are using <xsl:sort..> means that they have
	a current version of the XSLT processor installed
	on the client.  Given these conditions, you can
	use something similar to the sample at
	http://msdn.microsoft.com/xml/samples/portfolio/sort.htm
	the basic idea is the you use javascript to create
	the filtered/sorted output and use DHTM .innerHTML to
	place this in an element somewhere.  The example above
	does not do any pretty formatting, but I pointed to it
	because it should be easy to understand, and you should
	be able to see from there if you will need to change the way
	the DOM is accessed or something to make it compatible with
	Netscape 6 when it releases.  Also you may want to
	experiement with that version calling XSLT transform. 
	The basic idea is to use DHTML DOM, which is illustrated 
	there though.  For a dynamic client sort sample with prettier 
	formatting, see
	http://msdn.microsoft.com/xml/samples/stock-sorter/stock-sorter.xml.

	Thanks,
	Joshua 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]