- XSLT Tutorial
- XSLT Useful Resources
Jun 22, 2010 generate-id generates an id value which can differ based on the XSLT processor you use so I don't think you want to use it for the above code. You simply seem to want to insert the 'id' attribute value of the 'bib' element for each 'author' element so you could simply write a template. 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.
- Selected Reading
<xsl:key> tag element specifies a named name-value pair assigned to a specific element in an XML document. This key is used with the key() function in XPath expressions to access the assigned elements in an XML document.
Declaration
Following is the syntax declaration of <xsl:key> element.
Attributes
S.No | Name & Description |
---|---|
1 | Name Name of the key to be used. |
2 | Match Patterns used to identify a node that holds this key. |
3 | Use XPath expression to identify the value of the nodes of xml document. |
Elements
Number of Occurrences | Unlimited |
Parent elements | xsl:stylesheet |
Child elements | None |
Demo Example
This example creates a table of <student> element with its attribute rollno and its child <firstname>, <lastname>, <nickname>, and <marks> by iterating over each student. It checks key as firstname to be one of the student's name and then prints the student details.
students.xml
students.xsl