In listing 1, I have code that rejects duplicate <Article> elements in a
sorted list made up of items similar to those in Listing 2. Right now, the
filter considers the entirety of the immediately preceding sibling
<Article>. I think this code seems to work as advertised.
However, I now want it to disregard the <Page> element during the comparison
so that the two articles in Listing 2 would be considered identical and the
"citation" template in Listing 1 would not be called.
I tried :
<xsl:if test="not(Title eq preceding-sibling::Article[1]/Title)
and not(Year eq preceding-sibling::Article[1]/Year)
and not(IssueNumber eq
preceding-sibling::Article[1]/IssueNumber)"
but that code does not work at all.
What is the proper way to remove duplicates by comparing the Title, Year,
and IssueNumber elements while ignoring the Page element in the immediately
preceding Article??
Thanks,
Mark
Listing 1.
<!-- Each title will have one or more citations -->
<xsl:template match="Article" mode="format">
<xsl:if test="not(. eq preceding-sibling::Article[1])">
<xsl:call-template name="citation"/>
<xsl:apply-templates select="Comment"/>
</xsl:if>
</xsl:template>
Listing 2.
<Article>
<Title>Future Issues</Title>
<IssueName>Apr</IssueName>
<Year>1948</Year>
<Page>38</Page>
<IssueNumber>4</IssueNumber>
</Article>
<Article>
<Title>Future Issues</Title>
<IssueName>Apr</IssueName>
<Year>1948</Year>
<Page>39</Page>
<IssueNumber>4</IssueNumber>
</Article>