View Single Post
  #4 (permalink)  
Old August 29th, 2019, 04:13 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Unfortunately you haven't shown the generateid named template.

Saxon's implementation of generate-id() delivers a two-part ID, the document number which will vary between runs, and the node-id within document which should be the same provided that the source document is the same. You could try picking this apart.

But a much simpler approach would be to use position().

Incidentally, a few observations on your code:

(a) You often use an xsl:variable containing an xsl:value-of where using xsl:variable/@select would be more appropriate

(b) With XSLT 2.0 the code becomes much more concise and readable if you use functions rather than named templates

(c) The xsl:if around the xsl:for-each appears redundant, though I can't be sure because of missing code.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
The Following User Says Thank You to mhkay For This Useful Post:
msambasiva@gmail.com (August 29th, 2019)