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

Re: Balanced Two column tables

Subject: Re: Balanced Two column tables
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 7 Mar 2000 15:40:22 GMT
select ordered on two columns
> Yes. Where can I find some documentation on node-set()? I'm using 
> XT to do the processing.

on xt's html documentation pages, although probably more useful to scan
the archives of this list for examples.

> Any suggestions on how to apply it to my current problem gratefully 
> received.

well if before you had

<xsl:apply-templates select="asdlkjfhba[ajshgc]//*[lkagdc]"/>

and now you want to apply the same templates but first sort the list
into order, do

<xsl:variable name="x">
 <xsl:for-each select="asdlkjfhba[ajshgc]//*[lkagdc]">
   <xsl:sort select="jhfvgkjb"/>
   <xsl:copy-of select="."/>
 </xsl:for-each>
</xsl:variable>

so now you have your nodes in sorted order except they are rather
unhelpfully in a result-tree-fragment not a node set so you can't access
them, but not being able to access them is more or less the only
difference between a node set and a result tree fragment (the other
being the method of coercion to booleans) and so xt and saxon provide
a node-set fuction and microsoft rather unhelpfully provide implicit
coercion that gives you back a node-set.

so to apply your templates you now do

<xsl:apply-templates select="xt:node-set($x)/*"/>


xt:node-set() works like document() you get a new input tree with its
own root and all teh axes like following-sibling work on the document
order of _that_ tree (ie sorted order) not on the document order in
the original document.

Note that even though you get a node-set and not a node list, the order
is preserved, the node set just has _one_ node, the root node, and
the nodes you are interested in are in sorted order.

That's the reason for the /* in the xt:node-set($x)/* to make sure you
get the nodes you want rather than the root node, which may or may not
give you the same thing, depending on what your template matching "/"
does.



David


 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.