[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Same generate id for root element??
Hi Dipesh, Unfortunately, you can't do that with the generate-id() function. If you check the specification for that function, you'll find that there is no guarantee made about the outcome value of that function aside from the guarantee that for every unique node you'll get a unique value. Each time you run the stylesheet, there is no guarantee as to what you'll get out - you might get the same values, or you might get something completely different. However, there's no way to know, and the specification doesn't force this to happen either way. The other problem that you'll face is that, in two different sessions, you might well end up generating identical ids for different nodes, and there is no way to prevent this. Michael Kay's XSLT Programmer's Reference puts it this way: 'The generated identifiers are unique within a single execution of the stylesheet. If the stylesheet is used several times, with the same of different source documents, it may generate the same identifiers in each run but is under no obligation to do so.' If you want to achieve a unique value across multiple runs, you'll have to feed in something unique such as the current time as a parameter and prefix your generate-id() function with that parameter. The combination of the two should give you a unique identifier, but you'll have to pass it in each time you run the stylesheet. Allan |I am scanning the same xml file for "n" number of times. To my |surprise I am |gettin the same generated-id for roots in both the scan. |How do i implement it so that when the same xml file is taken |as input i |should get different generated id for my root node. |Thanks in the anticipationt that i will get some hint to solve |this problem. |Regards, |Dipesh XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|