Re: question about generate-id()
On Sun, 08 Aug 2010 09:19:55 +0100 Michael Kay <mike@xxxxxxxxxxxx> wrote:
Yes as xml:id defines "unique", just not within xml:id's uniqueness scope.
It has the same properties as xml:id, just in a different value set than where you find a document's xml:id values.
It *is* an identifier. It *is* a name token. It *is* unique in *its* value set.
It also happens to have a lexical constraint of only alphanumeric characters, thus allowing stylesheet writers to augment the identifier with "-", "." and "_" to construct custom identifiers on top of generated identifiers without any name collision.
Or as the spec puts it: "it > always generates the same identifier for the same node and ... > different identifiers are always generated from different nodes."
That sentence describes the scope: the set of nodes. That scope doesn't say anything about the document's identifiers, but just to be clear, Mike cites the sentence in 16.6.4 in response to what you posit here:
> > My inferences: I assumed (clearly wrongly by this thread) that it > > generated an ID value (call it xml:id for now) that was unique as > > per the definition in XML, i.e. unique amongst the nodes of the > > input document. > > > > The spec explicitly says "There is no guarantee that a generated > unique identifier will be distinct from any unique IDs specified in > the source document.".
No, "generate-a-name-token-suitable-for-an-id()" might be more "accurate", but wouldn't be more suitable. The function generates an identifier. The values returned qualify as identifiers. Even the name "generate-an-id()" is no better than "generate-id()". Though, in retrospect, I would have liked it to have been "generated-id()" since that reflects the nature that it doesn't change when visit the same node twice within a single transformation, but I can live with that.
I really hope this helps you feel more comfortable that the specification has got it right in this situation.
. . . . . . . . . . Ken
-- XSLT/XQuery training: after http://XMLPrague.cz 2011-03-28/04-01 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format