[xsl] question about generate-id()

Subject: [xsl] question about generate-id()
From: "steve.majewski@xxxxxxxxx" <steve.majewski@xxxxxxxxx>
Date: Wed, 4 Aug 2010 17:39:38 -0400
When our EAD/XML files are edited, we run them thru a stylesheet that checks
that certain sections all have @id attributes, and if not, adds them using generate-id().


I've recently discovered that some of those files now have duplicate ids.

I think we've had a misconception about the uniqueness of generated ids.
A closer reading of M.Kay's book, as well as searching this lists recent archives
says that it's "guaranteed to be unique for every node that participates in a given transform"


Additionally, in one of those other threads, Florent Georges wrote:

 Yes.  And it is guaranteed to generate always the same ID when
called on the same node.



I suspect that what was not explicitly stated but implied by that clause is that
it means that it is unique for nodes *generated* in a given transform, and
not including those ids that are passed thru and copied from the input to the output doc.


We have generated nodes id's from previous transforms. Usually, these do seem
to be unique -- I suspect because of that additional condition above about "same node".
I think the cases where we do have duplicates were when a new element was inserted
above another of the same kind, with a previously generated id. This new node -- although
having entirely different content -- is considered "the same node" in the sense that
it has the same xpath, for example: /ead/archdesc/dsc/c01[1]/c02[1]
( the previous node, being "pushed down" to //c02[2] )



Am I (finally!) understanding this correctly ?
Does the above sound like a reasonable and likely explanation of what's happening ?



-- Steve Majewski / UVA Alderman Library


Current Thread