xsl-list
[Top] [All Lists]

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

2007-02-27 16:05:54
Michael Kay wrote:
But please get out of the habit of using xsl:value-of
when you mean xsl:sequence, and please get into the habit of declaring the
types of your functions! This should be

For your comfort: that is precisely the way it is in my XSLT, I just left it out for brevity ;)

And indeed, I still often use xsl:value-of, I partially blame XSLT 1 for that: I use both on a daily basis and get confused....

The cheapest solution is probably a text or comment node rather than an
element, something like:

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

Remember that an LRE like <node/> might be creating a lot of namespaces...

That is a great tip. Thanks!

-- Abel

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