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

Subject: Re: [xsl] How to use generate-id() inside an xsl:function without a node available?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Feb 2007 21:52:10 GMT
> 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?

no a literal result element like <x/> is (more or less) the same as using
<xsl:element name="x"/> it's a single node in the stylesheet but it
generates a new node each time it's executed, and generate-id() is being
applied to that result. You don't need an element at all of course, a
text node will do

<xsl:function name="pref:myId" as="xs:string">
 <xsl:variable name="myNode">x</xsl:variable>

  <xsl:sequence select="generate-id($myNode)"/>

<xsl:function



(you can't use
 <xsl:variable name="myNode"/> as that generates a zero length string
 not a node at all, for reasons of xslt1 cmpatibility)

David

Current Thread