xsl-list
[Top] [All Lists]

Re: [xsl] How to use generate-id() inside an xsl:function without a node available?

2007-02-27 15:00:15
Dimitre Novatchev wrote:
I think in this case generate-id() will be applied on the same node
again and again and will return the same string -- this is why I want
always to have a new copy of it -- or am I wrong?

I am honoured with so much attention for such a seemingly simple question ;)

Inside a function, apparently, the node is recreated on each function call. Whether it is this:

<xsl:function name="my:getNode"><node /></xsl:function>
<xsl:function name="my:getId"><xsl:value-of select="generate-id(my:getNode())" /></xsl:function>

or whether you use variables to achieve the same result. Apparently, the node need not be part of the result tree to achieve this effect (maybe it is, I don't know, but it is never output at least).

The variable-inside-one-function (like David's solution) is the one I currently employ, but any variant is likely to succeed if I understand Michael Kay correctly.

-- Abel Braaksma

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