Subject: Re: Balanced Two column tables From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 7 Mar 2000 15:40:22 GMT |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Balanced Two column tables, Leigh Dodds | Thread | extensions, ces |
XT (XSLServlet) ignores media-type , Tom Myers | Date | using xt-extensions for getting a s, felix |
Month |