xsl-list
[Top] [All Lists]

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

2007-02-27 14:52:34


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

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

<Prev in Thread] Current Thread [Next in Thread>