This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

selecting then conditional test


I'm new at xml but after looking through the help and FAQs I still can't
figure this out. I'm trying to remove duplicates from a list, sort it, and
also check for other things not to display.

My xml is as follows:

<alljobs>
<job>
  <item1>two</item1>
  ...
</job>
<job>
  <item1>one</item1>
  ...
</job>
<job>
  <item1>two</item1>
  ...
</job>
<job>
  <item1>N/A</item1>
  ...
</job></alljobs>

What I want to do is display a sorted list without duplicates and without
the N/A like so:

one
two

My xsl is as follows:

<xsl:template match="alljobs">
<xsl:for-each select="job/item1[not(.=following::job/item1)]">
  <xsl:sort/>
  <xsl:if test="ancestor::job/item1!='N/A'">
    <xsl:value-of select="."/>
  </xsl:if>
</xsl:for-each>

I've also tried: <xsl:if test="//item1!='N/A'">

Unfortunately these don't work. I eliminate the duplicates and sort it but
the if statement doesn't work. What am I doing wrong? Thanks for your help!


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]