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

RE: Is it possible to reference the previous and next

Subject: RE: Is it possible to reference the previous and next elements inside a for-each
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Mon, 12 Apr 2004 10:17:50 +0200
xsl next sibling reference
> -----Original Message-----
> From: Ian Lang [mailto:ianplang@xxxxxxxxx]
>
>
> I am working on a navigation bar for my output HTML.
> When executing a for-each like this:

Hi,

So, in short, the structure looks like:

<xsl:for-each select="x">
  <xsl:sort select="..."/>
  <xsl:apply-templates mode="createContent"
                       select=".">
    <xsl:with-param name="prevEl"
                    select="..."/>
    <xsl:with-param name="nextEl"
                    select="..."/>
  </xsl:apply-templates>
</xsl:for-each>


Remember that if you were to do:

<xsl:apply-templates select="x"
                     mode="createContent">
  <xsl:sort select="..." />
</xsl:apply-templates>

Then in the matching template the requested previous and following x are
available on the preceding and following (-sibling) axes, so there is really
no need to pass these in with parameters (but if you insist, the axes can be
used to determine the value of the parameter in the above structure as
well..)

<xsl:template match="x" mode="createContent">
  <xsl:variable name="prev"
                select="preceding-sibling::x" />
  <xsl:variable name="next"
                select="following-sibling::x" />
  ...
</xsl:template>


Hope this helps!

Cheers,

Andreas

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.