Generate-id Key In Xslt

broken image


Declaring Keys and Performing Lookups. February 6, 2002. Bob DuCharme. When you need to look up values based on some other value - especially when your stylesheet needs to do it a lot - XSLT's xsl:key instruction and key function work together to make it easy. They can also make it fast. Creating a Simple Key. Open Keys/Exercises/SimpleKey.xml and review the code. You will see that it contains a list of City elements. Part of the code is shown below. Open Keys/Exercises/SimpleKey.xsl for editing. Create a key that indexes the City nodes by their State attribute. Using the key.

-->

Returns a string that uniquely identifies the node in the node-set argument that is first in document order.

Key

Generate-id Key In Xslt Excel

Remarks

The unique identifier must consist of ASCII alphanumeric characters and must start with an alphabetic character. Thus, the string is syntactically an XML name. There is no guarantee that a generated unique identifier will be distinct from any unique IDs specified in the source document. If the node-set argument is empty, the empty string is returned. If the argument is omitted, it defaults to the context node.

Example

XML File (data.xml)

XSLT File (sample.xsl)

This is the formatted output:

When you click the left button in Internet Explorer, an alert box displays 'IDAHAGJD'.

When you click the right button in Internet Explorer, an alert box displays 'IDAPAGJD'.

Notice that the ID value is generate at run-time. Therefore, the specific values may vary in different invocation of the transformation.

Xslt

Generate-id Key In Xslt Excel

Remarks

The unique identifier must consist of ASCII alphanumeric characters and must start with an alphabetic character. Thus, the string is syntactically an XML name. There is no guarantee that a generated unique identifier will be distinct from any unique IDs specified in the source document. If the node-set argument is empty, the empty string is returned. If the argument is omitted, it defaults to the context node.

Example

XML File (data.xml)

XSLT File (sample.xsl)

This is the formatted output:

When you click the left button in Internet Explorer, an alert box displays 'IDAHAGJD'.

When you click the right button in Internet Explorer, an alert box displays 'IDAPAGJD'.

Notice that the ID value is generate at run-time. Therefore, the specific values may vary in different invocation of the transformation.

This is the processor output:

Gambardella, Matthew

Ralls, Kim

Generate-id() In Xslt

See Also

Generate-id Key In Xslt 2016

Reference





broken image