[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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

"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
Keywords
xsl