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

RE: Grouping over multiple files

Subject: RE: Grouping over multiple files
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 14 Jan 2006 21:35:29 -0000
RE:  Grouping over multiple files
> Florent, would you be kind enough to explain the function.

Actually, I think it should be using the operator "is" rather than "=". But
it's trying to return one of the strings "north", "south", etc, depending on
which of the four global variables is the root of the tree containing the
parameter $node.

I would personally be inclined to write it as

 <xsl:function name="k:get-source" as="xs:string">
   <xsl:param    name="node" as="node()"/>
   <xsl:variable name="root" as="node()" select="root($node)"/>
   <xsl:sequence select='
     for $i in 1 to 4 return
       if (($north, $south, $east, $west)[$i] is $root)
       then ("north", "south", "east", "west")[$i]
       else ()'/>
  </xsl:function>


> 
> >       <xsl:function name="k:get-source" as="xs:string">
> >         <xsl:param    name="node" as="node()"/>
> >         <xsl:variable name="root" as="node()"
> >                       select="root($node)"/>
> >         <xsl:choose>
> >           <xsl:when test="$root = $north">
> >             <xsl:text>north</xsl:text>
> >           </xsl:when>
> >           <xsl:when test="$root = $south">
> >             <xsl:text>south</xsl:text>
> >           </xsl:when>
> >           <xsl:when test="$root = $east">
> >             <xsl:text>east</xsl:text>
> >           </xsl:when>
> >           <xsl:when test="$root = $west">
> >             <xsl:text>west</xsl:text>
> >           </xsl:when>
> >           <xsl:otherwise>
> >             <xsl:message terminate="yes">
> >               <xsl:text>Unjnown source!</xsl:text>
> >             </xsl:message>
> >           </xsl:otherwise>
> >         </xsl:choose>
> >       </xsl:function>
> > 
> 
> 
> Thanks.
> 
> --
> Kevin

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.