[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

parameter oddness

Subject: parameter oddness
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Mon, 6 Jun 2005 10:45:37 -0400
xsl choose parameter
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.