xsl-list
[Top] [All Lists]

RE: How do you select all unique first-position characters?

2002-11-21 08:50:16
Jeff,

That's a node identity test.

count(.) always returns 1. count(.|$node) returns 1 if the current node is the same node as $node, 2 if not. key('keyname',$string)[1] returns the first node in document order whose 'keyname' key value is $string. You get the rest.

It's one of those XPath 1.0 idioms that we've learned to live with.

Cheers,
Wendell

Wendell,

Could you explain to me why the union of the current node with that of the
first node returned from the xsl:key is needed in the count?

Wouldn't that always be 1?  I know it's not, because it works.

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
    "Thus I make my own use of the telegraph, without consulting
     the directors, like the sparrows, which I perceive use it
     extensively for a perch." -- Thoreau


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