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[(_at_)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(_dot_)delmelle(_at_)pandora(_dot_)be> wrote
on 2004-04-12 01:17:50:
-----Original Message-----
From: Ian Lang [mailto:ianplang(_at_)yahoo(_dot_)com]
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