GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes XSLT question:  about xsl:key() functions. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT question:  about xsl:key() functions." Watch "XSLT question:  about xsl:key() functions." New topic
Author

XSLT question: about xsl:key() functions.

Roy Huang
Ranch Hand

Joined: Nov 21, 2001
Posts: 104
Can anybody here clear expalin to me:
what the following code means:
generate-id(.)=generate-id(key('keyid', @TYPE)[1])
1.what means [1]?
2.what kind of parameter y can I give? suppose in key(x,y) function...
must it be an element, can I give a direct value or attribute?
3.(.) means create the id in current Node?

Thanks,
Roy
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Roy:
generate-id(.)=generate-id(key('keyid', @TYPE)[1])
1.what means [1]?
Select the first element found, that has the same TYPE attribute
value as the value of the current element. The element match is
done by the keyid definition. This is a general stmt, specific
data depends on how "keyid" is defined.
2.what kind of parameter y can I give? suppose in key(x,y) function...
must it be an element, can I give a direct value or attribute?

I think the parameter 'y' can take any string value. However, generally
it is the value of an attribute or something like that. The exact value
depends on how the key "x" is defined.
3.(.) means create the id in current Node?
Yup, create an id using the path to the current node (.).
Hope this helps.
regds.
- madhav


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
GeeCON Prague 2014
 
subject: XSLT question: about xsl:key() functions.