If it’s an option for you to create (possibly intermediate) database for your documents, db:node-id will certainly be the best choice to get unique IDs.
Von: Liam R. E. Quin via BaseX-Talk <basex-talk@mailman.uni-konstanz.de>
Gesendet: Montag, Februar 9, 2026 11:05:01 PM
An: Graydon Saunders via BaseX-Talk <basex-talk@mailman.uni-konstanz.de>
Betreff: [basex-talk] Re: persistent id values?
On Mon, 09 Feb 2026 11:26:14 -0500
Graydon Saunders via BaseX-Talk <basex-talk@mailman.uni-konstanz.de>
wrote:
> It's once I want to relate the id back to the document ("this
> generated value goes with this id attribute node") that I'm having
> trouble. I don't want to use path(); it'd work, but it's not an
> efficient approach. (Or at least I don't understand it as efficient.)
Yeah, the spec says the value can be used to locate a node, but there
doesn’t seem to be a htap() function to go from path to node.
So, since XQuery lacks xsl:key :), i build a map of generate-id()
values to nodes. But if you need to use it between database queries,
yes, attributes.
--
Liam Quin: Delightful Computing - Training and Consultancy in
XSLT / XML Markup / Typography / CSS / Accessibility / and more...
Outreach for the GNU Image Manipulation Program
Vintage art digital files - fromoldbooks.org