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

RE: generate-id() explanation

Subject: RE: generate-id() explanation
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 24 May 2010 19:19:24 +0100
RE:  generate-id() explanation
> Sorry about that. I tried this on one of my files, and ran 
> the transformation using saxon. But it generated the same ids 
> for two nodes in the same XML file. In my program I use
> 
> <list2 id="{generate-id(.)}">
> 
> That's the reason I asked again. I wanted to make sure I was 
> understanding this correctly.
> Does it matter if you say generate-id(.) or just generate-id()?

No, if you omit the argument then it defaults to the context node.

I see now where your problem lies. generate-id() produces a unique ID for
the node supplied as the argument. It knows nothing about nodes in the
output document. If you generate two nodes in the output from a single node
in the input, then generate-id(.) will produce the same value twice.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

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.