• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSLT question: about xsl:key() functions.

 
Roy Huang
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic