xsl-list
[Top] [All Lists]

Re: union vs. "or" vs. contains?

2004-10-19 11:37:21
On Oct 19, 2004, at 7:03 AM, David Carlisle wrote:

The following does the same, but I think it's clearer, and it's probably
more efficient as the test only has to be done once, not on every
element that might possibly match.

<xsl:apply-templates select="*[$foo='x']"/>
or perhaps clearer
<xsl:if test="$foo='x'">
 <xsl:apply-templates/>
</xsl:if>

I'm not understanding how to implement this. How do I distinguish among the five different mods:modsCollection templates I'm applying if I'm not putting a conditional statement on the match statement of those templates?

This is what I started to do, but it's not making much sense to me.

<xsl:template match="db:bibliography">
  <xsl:choose>
  <xsl:when test="not($citation-class='note-nobib')">
    <div id="bibliography">
      <h2>References</h2>
      <xsl:choose>
        <xsl:when test="$citation-class='author-year'">
<xsl:apply-templates select="mods:modsCollection[$citation-class='author-year']" mode="bibliography"/>
        </xsl:when>
        <xsl:when test="$citation-class='citekey'">
<xsl:apply-templates select="mods:modsCollection[$citation-class='citekey']" mode="bibliography"/>
        </xsl:when>
        ....
      </xsl:choose>
    </div>
  </xsl:when>
  </xsl:choose>
</xsl:template>

Bruce