[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: question about generate-id()

Subject: Re: question about generate-id()
From: ac <ac@xxxxxxxxxxxxx>
Date: Fri, 06 Aug 2010 08:18:55 -0400
Re:  question about generate-id()
Hi,

On Thu, 5 Aug 2010 10:11:06 +0100 (IST)
"Tony Graham"<Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>  wrote:

Possibly not everybody uses @id to mean an ID, plus there's plenty of
other attributes, such as @name, that may or may not be IDs. The only
attribute that is guaranteed to be an ID is @xml:id, and that
postdates XSLT 1.0 by about six years.
In which case it is badly|wrongly named. I'd like to ask James about
the intention. I'm pretty sure it was for (what is now) xml:id
'generate-random-name'?


There are many uses for generate-id() apart from generating an id for an @id or @xml:id.
It generates node-based string uniqueness in a transformation which can be used in different ways, including combined with prefix and or suffix


Adding a generate-xml-id-from-source() may be a useful addition although it seems quite specific

Why not just use concat() or string-join(), along with generate-id() to do any and all of those and more things?

Am I missing something here?

Cheers,
ac






16.6.4
There is no guarantee that a generated unique identifier will be
distinct from any unique IDs specified in the source document.

Yuk. IMHO that's a spec weakness. More constrained, surely
it's not rocket science to implement.
You could do it yourself
Which would IMHO be a kludge to work round a spec weakness.
Yes. Lots of ways to do it as this thread has shown.

In this brave new world of streaming XSLT, you might not see the
existing ID value until after you've generated what would be a
duplicate ID.
Even with a large document I'm pretty sure it's possible to pull
any (xml:)id values - from the source, not the built output
to check for uniqueness.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.