[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Functions Returning Nodes in XSLT 2.0

Subject: Re: Functions Returning Nodes in XSLT 2.0
From: Alan <alan-xsl-list@xxxxxxxxx>
Date: Fri, 20 May 2005 11:57:23 -0400
Re:  Functions Returning Nodes in XSLT 2.0
* Dimitre Novatchev <dnovatchev@xxxxxxxxx> [2005-05-19 19:41]:
> On 5/20/05, Alan Gutierrez <alan-xsl-list@xxxxxxxxx> wrote:
> >    In XSLT 2.0 with Saxon 8.4...
> > 
> >    I've written helper methods that look like so.
> > 
> >    <xsl:function name="fn:user" as="element()">
> >      <xsl:param name="login"/>
> >      <xsl:copy-of
> >        select="document('users.xml')/users/user[login = $login]"/>
> >    </xsl:function>
> > 
> >    Making it easier to write select attributes.
> > 
> >    <xsl:value-of select="fn:user()/first-name"/>
> > 
> >    Some of my XPath is getting complicated, so I like to wrap it up
> >    into functions.
> > 
> >    I'm wondering if copy-of is smart enough to forgo copying in
> >    such cases.
> 
> No, xsl:copy-of does what it name says.
> 
> >  If not, I could see how it could get expensive to
> >    call fn:user every time I wanted a property.
> > 
> >    Is there a better practice for this sort of thing?
> 
> Yes. 
> 
> Use:   xsl:sequence

    Thank you, Dimitre. Perfect.

--
Alan Gutierrez - alan@xxxxxxxxx
    - http://engrm.com/blogometer/index.html
    - http://engrm.com/blogometer/rss.2.0.xml

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.