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

Re: Feature Request - Node Set Processing (long)

Subject: Re: Feature Request - Node Set Processing (long)
From: James Clark <jjc@xxxxxxxxxx>
Date: Mon, 18 Jan 1999 09:33:37 +0700
xsl current node name
"G. Ken Holman" wrote:

> (4) - so, I need to walk the source tree at each level of interest and
> determine if where I am (or my ancestor module is) is where I was before I
> started walking, and at each step render different information calculated
> from where I am walking:
> 
>     current node = page being rendered
>     current module node = ancestor-or-self(intro|module|exit)
>     For each node in (/course/intro
>                       /course/module
>                       /course/exit)          ;first button bar
>      {
>       if( node = current module node )
>         render green button without hyperlink
>       else
>         render blue button with hyperlink
>      }
>     For each node in (/course/module/lesson) ;second button bar
>      {
>       if( node = current node )
>         render green button without hyperlink
>       else
>         render blue button with hyperlink
>      }

If XSL had local constants/variables, you could express exactly that
algorithm:

   ...
   <xsl:constant name="current-node-name" value="{@id}"/>
   <xsl:constant name="current-module-name"
                value="{ancestor-or-self(intro|module|exit)/@id}"/>
   <xsl:for-each select="/course/intro|/course/module|/course/exit">
     <xsl:choose>
       <xsl:when test="@id=constant(current-module-name)">
          <!-- render green button without hyperlink -->
       </xsl:when>
       <xsl:otherwise>
          <!-- render blue button with hyperlink -->
       </xsl:otherwise>
     </xsl:choose>
   </xsl:for-each>
   <xsl:for-each select="/course/module/lession">
    <xsl:choose>
       <xsl:when test="@id=constant(current-node-name)">
          <!-- render green button without hyperlink -->
       </xsl:when>
       <xsl:otherwise>
          <!-- render blue button with hyperlink -->
       </xsl:otherwise>
     </xsl:choose>
   </xsl:for-each>


James


 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.