xsl-list
[Top] [All Lists]

parameter oddness

2005-06-06 07:45:37
In a solution to a problem I posted about (and David C. and Mike Kay helped me with) a couple of weeks ago, I've got a parameter I'm passing as an element from another template. That source of that element looks like:

<multiple-authors min-authors="6" use-first="6">et al.</multiple-authors>

For some reason, though, I'm not able to access the parameter element content within the choose statement below, while it works fine in the top level message. Likewise, I can access the attribute content of $multi-authors.

Why?

Comments below at the two key locations.

  <xsl:template match="mods:name" mode="short">
    <xsl:param name="multi-authors" as="element(cs:multiple-authors)?"/>
<xsl:variable name="multi-author-use-first" select="$multi-authors/@use-first" as="xs:integer?"/> <xsl:variable name="multi-author-min" select="if ($multi-authors/@min-authors) then ($multi-authors/@min-authors) else xs:integer('999')" as="xs:integer"/>
    <xsl:variable name="use-multi-author-handling"
select="xs:integer(count(../mods:name[mods:role/mods:roleTerm=$primary- contributors])) ge
      $multi-author-min" as="xs:boolean"/>
    <xsl:message>
     <!-- using $multi-authors here returns correct message content -->
      <xsl:value-of select="$multi-authors"/>
    </xsl:message>
    <xsl:choose>
      <xsl:when test="$use-multi-author-handling">
        <xsl:choose>
<xsl:when test="position() le xs:integer($multi-authors/@use-first)"> <xsl:apply-templates select="mods:namePart[not(@type='given')]"/>
            <xsl:choose>
              <xsl:when test="position() = last()"> </xsl:when>
              <xsl:otherwise>, </xsl:otherwise>
            </xsl:choose>
          </xsl:when>
        </xsl:choose>
        <xsl:if test="position() = last()">
          <xsl:text> </xsl:text>
<!-- using $multi-authors does not work here; content is blank. Hence I replace with 'et al.', which works -->
          <xsl:value-of select="'et al.'"/>
        </xsl:if>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

Bruce


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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