[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

Subject: RE: Designs for XSLT functions (Was: Re: RE: syntax sugar for call-template)
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Mon, 19 Feb 2001 21:07:44 -0000
xslt comma separated list
> But this sparked something for me - having an exsl:return inside a
> xsl:for-each:
>
>    <xsl:for-each select="$node">
>       <xsl:if test="*">
>          <exsl:return select="true()" />
>       </xsl:if>
>    </xsl:for-each>
>
> (in effect equivalent to <exsl:return select="boolean($node[*])" />)
>
> Perhaps xsl:for-each shouldn't be allowed directly within function
> definitions?  Can anyone come up with a use case where it's helpful to
> have it?

Saxon allows xsl:for-each with saxon:function, but doesn't allow
saxon:return within xsl:for-each.

Use case, turning a node-set into a comma-separated list of the
string-values of the nodes:

xsl:function name="csv"
  xsl:param name="nodeset"/
  xsl:variable name="tree"
    xsl:for-each select="$nodeset"
      xsl:value-of select="."
      xsl:if test="position()!=last"
        ,
      /xsl:if
    /xsl:for-each
  /xsl:variable
  xsl:return select="string($tree)"/
/xsl:function

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.