Re: Feature Request - Node Set Processing (long)

Subject: Re: Feature Request - Node Set Processing (long)
From: James Clark <jjc@xxxxxxxxxx>
Date: Sat, 16 Jan 1999 16:13:05 +0700
"G. Ken Holman" wrote:

> Does this explanation make more sense than my first explanation?

Not really.  You are explaining your proposed solution to a
transformation problem, without really explaining the transformation
problem itself. What does your source tree look like, and what is the
result tree you are trying to get from it? Without knowing this, it is
not possible to evaluate your proposed solution and to consider
alternative solutions.

For example, when I see:

   <xsl:choose select="/course/intro|
                       /course/lesson|
                       /course/exit"
               test="next">
     <xsl:when>
       <a href="{@id}.htm"><img src="active-right-arrow.gif"/></a>
     </xsl:when>
     <xsl:otherwise>
       <img src="inactive-right-arrow.gif"/>
     </xsl:otherwise>
   </xsl:choose>

I don't understand why you can't just use:

   <xsl:choose>
     <xsl:when test="next-element()">
       <a href="{next-element()/@id}.htm"><img
src="active-right-arrow.gif"/></a>
     </xsl:when>
     <xsl:otherwise>
       <img src="inactive-right-arrow.gif"/>
     </xsl:otherwise>
   </xsl:choose>

If the problem is that you want to skip certain siblings, then you can
do:

 <xsl:invoke macro="forward-link"/>

...

<xsl:template match="intro|lesson|exit" mode="forward-link">
    <a href="{@id}.htm"><img src="active-right-arrow.gif"/></a>
</xsl:template>

<xsl:template match=*" priority="-1" mode="forward-link">
  <xsl:invoke macro="forward-link"/>
</xsl:template>

<xsl:macro name="forward-link">
  <xsl:choose>
     <xsl:when test="next-element()">
       <xsl:apply-templates select="next-element()"
mode="forward-link"/>
        </xsl:when>
     <xsl:otherwise>
       <img src="inactive-right-arrow.gif"/>
     </xsl:otherwise>
   </xsl:choose>
</xsl:macro>

James


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


Current Thread