YouTip LogoYouTip

El Key

# XSLT Element * * Complete XSLT Elements Reference](#) * * * ## Definition and Usage The element is a top-level element that declares a named key (i.e., a name-value pair assigned to specified elements in an XML document). This key is used in the stylesheet via the key() function to help you efficiently access assigned elements within complex XML documents. **Note:** Keys do not need to be unique! * * * ## Syntax ## Attributes | Attribute | Value | Description | | --- | --- | --- | | name | name | Required. Specifies the name of the key. | | match | pattern | Required. Defines which nodes the key applies to. | | use | expression | Required. Specifies the expression to use as the key value for each node. | ### Example 1 Assume you have an XML file named "persons.xml": You can define a key in your XSL file as follows: To find the person with id="050676", use the following code (in the XSL file):

Id:
Name:

* * Complete XSLT Elements Reference](#)
← El MessageEl Include β†’