|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Balanced Two column tables
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








