[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Grouping and Sorting on value inside group


Subject: RE: [xsl] Grouping and Sorting on value inside group
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 11 Jun 2002 17:48:40 -0400

Well....

At 04:40 PM 6/11/2002, Peter wrote:
I finally found the answer.  Your use of [@dataid = current()/@dataid]
provided the missing clue:

      <xsl:for-each select="(//dataset/*/*[generate-id() =
generate-id(key('dataids', concat(local-name(..),@dataId)))])">
         <xsl:sort select="parent::node()/*[local-name() = $sortcol and
@dataId = current()/@dataId]/value"/>

...


The last step is to look at using more keys.  I'd still like to know if I
can use a key or some combination of keys to eliminate the //dataset
reference in the for-each...(anyone)???

The expression


(//dataset/*/*[generate-id() =
               generate-id(key('dataids', concat(local-name(..),@dataId)))])

would seem on the face of it to find the same node as

key('dataids', concat(local-name(..),@dataId))[1]

since the node inside any dataset that has the same generated ID as the first node in the set returned by the key expression, is that node (or nothing).

To introduce the constraint that your node must be two levels under a dataset, you could do

key('dataids', concat(local-name(..),@dataId))[1][../parent::dataset]

... But there's only ever one such node; sorting it has no effect.

What am I missing? (I admit I'm looking at this thread late.)

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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




Current Thread
Keywords
xml