xsl-list
[Top] [All Lists]

Re: [xsl] generate-id() explanation

2010-05-24 13:56:20
That explains it! Thanks so much! It was a bug in the other part of
the code that was calling the same list2 element.

Thanks again in helping me understand this definition and usage.

On 5/24/10, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
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


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--