xsl-list
[Top] [All Lists]

Article Paging With Conditions

2003-01-16 08:54:18

Hello,

I am creating a newsletter for a Web site based in XML and XSL.

Each article in the newsletter is given an numeric ID number and I want to put 
Previous and Next links at the bottom of each article. That works fine.

The problem is that I do not want some articles to be accessible to previous 
and next because they are small articles or helper articles. A snippet of the 
xml code is below:

<article id="1" display="contents" />
<article id="2" display="contents" />
<article id="3" display="contents" />
<article id="4" display="none" />
<article id="5" display="none" />
<article id="6" display="contents" />

Basically what I am trying to do is if the user is on article three, the next 
link would display the title for article 6 instead of article 4. The number and 
position of the nodes where the attribute display="none" is arbitrary so I 
can't just code to skip the nodes because it could be different for every xml 
file.

Currently, this is what I have for the next button (and it does work as 
implemented). Notice it just checks for the next article with an ID one greater 
than the current and displays the link to that article node. If no node is 
present it simply displays nothing.

<xsl:if test="../article[(_at_)id = $artID + 1]">
  <span style="width: 43%; float: right; text-align:right;">
    <a class="BottomNav" 
      href="/cattails/{$issueID}/default.asp?artID={$artID + 1}">
    <img src="/cattails/images/next.gif" align="right" border="0" 
      vspace="12" hspace="5" /><strong>Next Article</strong><br />
    <xsl:value-of select="../article[(_at_)id = $artID + 1]/title" /></a></span>
</xsl:if>

I need to somehow modify this code to skip any article nodes with an attribute 
display="none". Any help would be greatly appreciated on this!

TIA

Ben

=================================
Benjamin R. Kubs
Web Developer
Marshfield Clinic
www.marshfieldclinic.org
kubs(_dot_)benjamin(_at_)marshfieldclinic(_dot_)org


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



<Prev in Thread] Current Thread [Next in Thread>