xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Functions Returning Nodes in XSLT 2.0


Subject: [xsl] Functions Returning Nodes in XSLT 2.0
From: Alan Gutierrez <alan-xsl-list@xxxxxxxxx>
Date: Thu, 19 May 2005 19:33:48 -0400

    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. 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? 

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


Current Thread
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor