xsl-list
[Top] [All Lists]

Re: [xsl] question about generate-id()

2010-08-06 11:30:49
At 2010-08-06 16:53 +0100, Dave Pawson wrote:
On Fri, 06 Aug 2010 16:37:09 +0100
David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

> On 06/08/2010 12:31, Dave Pawson wrote:
>
> >
> > If implementations did what the casual reader might assume
> > I wouldn't have to Andrew?
> >
> > The spec, read today, with xml:id existent, is misleading.
> >
> xml:id isn't related to generate-id is it?

It is the 'todays' version of id, as used in XML.

Fine.

Hence in my view generate-id() function should generate an id value
as defined in XML rec.

It does.

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(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--