To sort xml through xsl

Results 1 to 2 of 2

Thread: To sort xml through xsl

  1. #1
    Join Date
    Dec 1969

    Default To sort xml through xsl

    Hi All,<BR>I need to sort the xml elements using a xsl and I have done using &#060;xsl:sort&#062; specifying the element name in the xml.<BR>But now I need to sort the xml based on the insert date of the elements present in the database but not available in the original xml.Is it possible to sort this using xsql within xsl.<BR>Since the element with which I need to sort is not present in the original xml and only available in the database, is it possible to do this without modifying the xml ?<BR>Please help us to sort this out.

  2. #2
    Join Date
    Dec 1969

    Default RE: To sort xml through xsl

    I haven&#039;t tried this, but it might work:<BR><BR>&#060;xsl:stylesheet version="1.0" <BR> xmlns:xsl="" <BR> xmlns:msxsl="urn:schemas-microsoft-com:xslt" <BR> xmlns:bla="urn:bla"&#062;<BR> <BR> &#060;xsl:template match="/"&#062;<BR> &#060;xsl:apply-templates select="*"&#062;<BR> &#060;xsl:sort select="bla:GetDate(.)" /&#062;<BR> &#060;/xsl:apply-templates&#062;<BR> &#060;/xsl:template&#062;<BR> <BR> &#060;msxsl:script language="JScript" implements-prefix="user"&#062;<BR> function GetDate(nodelist) {<BR> // here a custom function that retrieves the date(s) from the database<BR> }<BR> &#060;/msxsl:script&#062;<BR>&#060;/xsl:stylesheet&#062;<BR><BR>I don&#039;t really know what the return type of the function should be: a single date (so that this function is called for each element), or a nodelist with all the dates... Try and see ;-)<BR><BR>Of course you can also use vbscript if this is running on a windows server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts