Re: question about generate-id()
On Fri, 06 Aug 2010 16:37:09 +0100 David Carlisle <davidc@xxxxxxxxx> wrote:
Hence in my view generate-id() function should generate an id value as defined in XML rec.
so yes, in my view, it is related David.
I don't follow your argument, Dave. An input document's identifiers have *no* relationship to generate-id().
Consider this: if your reasoning that generate-id() must produce a value set exclusive of the xml:id values to ensure that id values in the output are unique, this falls apart when you consider that the aggregation of two documents where each are independently (and validly) using the same value for xml:id=. The processor cannot automatically disambiguate them in the aggregation because that would break references.
However, if you follow my rule of thumb that *every* xml:id= or id= or ID-typed attribute named prod= (for example) is translated to output using the generate-id() for that node ... and every reference to those identifiers is replaced with the generated identifier for the referenced node, then the references will be both preserved and unambiguous in the result.
As to the earlier comment contributed regarding pointers from outside of the document to inside the document, in an aggregation where ids are not unique across the input set there would still be a problem of ambiguity even if the ids are not translated.
Therefore, generate-id() is necessarily independent of any knowledge of any content. It is a model implementation concept and not a data concept. In the classroom I teach this concept in the same discussion as the XPath data model, and the function is later on described as the exposition of this aspect of the implemented data model. This helps students understand that generate-id() is exposing a single value that has been generated for a given node, not actively generating new identifiers each time it is called for a given node in a single transformation.
I hope this is considered helpful.
. . . . . . . . . . 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