[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Designs for XSLT functions (Was: Re: RE: syntax su
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|