Xslt Generate Id Key Example
Xslt Generate Id Key Example 4,1/5 149 reviews
-->
  1. Xml Xsl Examples
  2. Xslt Generate Id Key Examples

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

The specification of generate-id is that it will always return the same ID for the same node and different IDs for different nodes. Thus, comparing the generate-id values of two nodes is the way you check whether they are the same node as opposed to just two nodes that happen to have the same value. Demo Example. This example creates a table of element with its attribute rollno and its child, and by iterating over each student. It checks key as firstname to be one of the student's name and then prints the student details.

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.

Generate

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:

<html>

Movavi 12 activation key generator. <body><button>Gambardella, Matthew</button>

Xml Xsl Examples

<button>Ralls, Kim</button></body>

</html>

See Also

Xslt Generate Id Key Examples

Reference