| 
 
Subject: RE: [xsl] Anyone can explain me this syntax? From: Jarno.Elovirta@xxxxxxxxx Date: Tue, 13 Jan 2004 17:32:37 +0200  | 
Hi,
> From Muenchian method of grouping, I always use something like this:
> 
> ROW[count(. | key('relacion_x_cobertura', REL_ID)[1]) = 1]
  key('relacion_x_cobertura', REL_ID)
will return a node-set whose "relacion_x_cobertura" key value is the same as the string value of REL_ID element,
 
  key('relacion_x_cobertura', REL_ID)[1]
of that node-set, select the first,
  . | key('relacion_x_cobertura', REL_ID)[1]
create an union of that node-set with the current node. Remember that a node-set will *not* contain dublicates, so if the current node is same node as the first one returned by the key, the resulting set will only contain the current node.
  count(. | key('relacion_x_cobertura', REL_ID)[1])
count the number of nodes in the union set,
  count(. | key('relacion_x_cobertura', REL_ID)[1]) = 1
and if the count is equal to one, return boolean true. In effect, check if the current node is the same node as the first one returned by the key.
> - Why the . (dot) is used? why if I omit it, it doesn't work 
> (it returns all elements)?
The current node. See <http://www.w3.org/TR/xpath#NT-AbbreviatedStep>.
> - What's the meaning of the | (pipe)?
You haven't read the XPath 1.0 spec, have you? See <http://www.w3.org/TR/xpath#NT-UnionExpr>.
> - What's the meaning of [1]? I have always used things like 
> [FIELD_NAME=some_value]. I understand that perfectly, but 
> what about placing only that number in the brackets? I tried 
> by using [2] and it worked too... or, perhaps I was lucky?
Read the XPath 1.0 spec, you'll feel better in the morning.
Cheers,
Jarno
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
  | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] Anyone can explain me thi, Amuchastegui, Maria | Thread | [xsl] Anyone can explain me this sy, Jaime Stuardo | 
| [xsl] is there an easy way to retri, Bill Riegel | Date | Re: [xsl] Anyone can explain me thi, David Carlisle | 
| Month |