[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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] parameter oddness
Subject: [xsl] parameter oddness From: Bruce D'Arcus <bdarcus@xxxxxxxxx> Date: Mon, 6 Jun 2005 10:45:37 -0400 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Math: Removing X number o, tomas.vanek | Thread | [xsl] parameter oddness, Bruce D'Arcus |
RE: [xsl] Math: Removing X number o, Andrew Welch | Date | Re: [xsl] spacing issue, Spencer Tickner |
Month |