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

Fwd: Re: Fw: Is it possible to reference the previous

Subject: Fwd: Re: Fw: Is it possible to reference the previous and next elements inside a for-each
From: Ian Lang <ianplang@xxxxxxxxx>
Date: Mon, 12 Apr 2004 10:54:03 -0700 (PDT)
xsl previous child
Your solution looked good.  I had been using the
for-each because I was redirecting to an index file as
well as generating HTML content for each node.  I
switched to for-each for the index file and
apply-templates for generation as you suggested but it
did not work as expected.  My navigation bar
generating template was using preceding-sibling and
following-sibling by default already.  The problem was
that the next and previous links still referenced
elements that were not part of the apply-template's
select statement.  I have a case of nested containment
like this:
  <toplevel>
    <container name="container1">
      <children>
        <child name="simple1" type="simple"/>
        <child name="complex1" type="complex"/>
        <child name="simple2" type="simple"/>
        <container name="container2">
          <children>
            <child name="simple3" type="simple"/>
            <child name="simple4" type="simple"/>
            <child name="complex2" type="complex"/>
          </children>
        </container>
      </children>
    </container>
  <toplevel>

In the style sheet I have this to generate content
HTML for all simple child elements:
  <xsl:apply-templates mode="createContent"
select="//child[@type='simple']">
    <xsl:sort select="@name"/>
  </xsl:apply-templates>

But the previous and next links in the gernated HTML
also include the elements of type complex which I do
not want.

Did I missunderstand what you were suggesting?

IL

"Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx> wrote
on 2004-04-12 01:17:50:
> > -----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
<snip>


__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

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.