This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Designs for XSLT functions (Was: Re: RE: syntax sugar for call-template)
Hi Miloslav,
>> I agree that for string manipulation, there's not much call for
>> anything very sophisticated, and you can always call out to a named
>> template if you need to. However, for node-set manipulation that's
>> not always an option - you can't get a named template to return a
>> node set.
>
> Actually you can:
Jeez, you really have to watch your terminology on this list! :)
> <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
version = "1.0" >>
Note above version is 1.0.
> <xsl:variable name="xxx">
> <xsl:call-template name="nodeset"/>
> </xsl:variable>
Therefore this variable is set to an RTF as its set by content.
> <xsl:template name="nodeset">
> <aaa>1</aaa>
> <aaa>2</aaa>
> <aaa>3</aaa>
> </xsl:template>
This template returns an RTF anyway.
> <xsl:template match="/">
> <xsl:value-of select="$xxx/aaa[2]"/>
> </xsl:template>
And this template will return an error on any conforming XSLT 1.0
processor because it tries to turn the RTF into a node set implicitly
(later versions of Saxon aren't conformant in this area).
But that's me being picky to get you back ;) I think that you were
talking about in XSLT 1.1? Sure, there named templates can return a
newly-created node set. However they *cannot* return a node set
consisting of already existing nodes such as those in the original
source document - only their copies. This is a major limiting factor
when you want to do set functions like intersection().
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list