[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to correctly apply Dimitre' generic sort template

Subject: How to correctly apply Dimitre' generic sort template
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Tue, 10 Jul 2001 18:05:10 +0800
sort template
Hi, Dimitre,

I try to work out an exercise to apply your generic sort, and  need your
kind help to show what I have missed in the xsl below.

What I am doing is to apply your example shown in vbxml.com,
http://www.vbxml.com/snippetcentral/main.asp?view=viewsnippet&lang=&id=v2001
0310050532
which can bring the last result from using named mergeSingleNode once,
and the template mergeSingleNode and binSearch from
genericSearchSort.sort.template.xsl.
This modification did not bring me a desired solution as below.
        19321004 19530323 19920714 19990417 20100714
This is the set from sorting the first five nodes, from all 10 nodes.

Besides, can you show to do following things:

1.  How to define comparison mode > or < using comparisonSelector variable?
    Your coding using gt1 and gt2 variable to define comparisonSelector
variable,
    I can not see any difference between these two.

2.  How to select the ascending or desending option for the given number of
nodes?
    Reading through the coding I have difficulty in locating a piece of
codings
    doing these things.

  I see the  generic sort can help me a lot in solving practical cases.
  Thanks for any of your help in advance.

**   xsl listing  **

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gt1="gt1"
xmlns:gt2="gt2" exclude-result-prefixes="gt1 gt2">
  <gt1:gt1 />
  <gt2:gt2 />
  <xsl:include href="genericSearchSort.sort.template.xsl" />
  <xsl:output method="text" />
  <xsl:variable name="gt1-Node" select="document('')/*/gt1:*[1]" />
  <xsl:variable name="gt2-Node" select="document('')/*/gt2:*[1]" />
  <xsl:template match="/">
  <xsl:variable name="theNodes" select="/dates/datesUnSorted/date" />
  <xsl:variable name="cntNodes" select="count($theNodes)" />
  <xsl:variable name="posLength" select="string-length($cntNodes)" />
  <xsl:variable name="comparisonSelector" select="$gt1-Node" />
  <xsl:variable name="theBuffer">
  <xsl:for-each select="$theNodes[position() < 6]">
  <xsl:sort select="@value" />
  <xsl:value-of select="concat(@value,' ')" />
  </xsl:for-each>
  </xsl:variable>
 <!--  $theResult will hold the result   -->
 <xsl:variable name="theResult">
 <xsl:call-template name="mergeSingleNode">
  <xsl:with-param name="theSiblings" select="$theNodes" />
  <xsl:with-param name="siblPosition" select="6" />
  <xsl:with-param name="sortPad" select="$theBuffer" />
  <xsl:with-param name="posLength" select="$posLength" />
  <xsl:with-param name="gtTypeNode" select="$comparisonSelector" />
  </xsl:call-template>
  </xsl:variable>
  <xsl:value-of select="$theResult" />
  </xsl:template>
  </xsl:stylesheet>


Sun-Fu Yang
sfyang@xxxxxxxxxxxxx


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.