[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
On Jun 6, 2005, at 10:58 AM, Bruce D'Arcus wrote:
Actually, I spoke too soon. The parameter is being passed, but it seems the text content of the element is not. Didn't even know that was possible!
The "when" branch of the choose within cs:first is working as expected, but the otherwise branch gives me the odd behavior (I can grab the attribute content from the templates the multi-author is passed to, but the element content is empty). Any suggestions?
<xsl:template match="cs:citation">
<xsl:param name="source" as="element()"/>
<xsl:param name="first-ref" as="xs:boolean"/>
<xsl:choose>
<xsl:when test="cs:first">
<xsl:choose>
<xsl:when test="$first-ref">
<xsl:apply-templates select="cs:first/cs:layout/cs:creator">
<xsl:with-param name="source" select="$source" as="element()"/>
<xsl:with-param name="multi-authors" select="cs:first/cs:multiple-authors" as="element(cs:multiple-authors)?"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="if (cs:subsequent/cs:layout) then (cs:subsequent/cs:layout/cs:creator)
else (cs:first/cs:layout/cs:creator)">
<xsl:with-param name="source" select="$source" as="element()"/>
<xsl:with-param name="multi-authors" select="if (cs:subsequent/cs:multiple-authors) then (cs:subsequent/cs:multiple-authors)
else (cs:first/cs:multiple-authors)" as="element(cs:multiple-authors)?"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="cs:all/cs:layout/cs:creator">
<xsl:with-param name="source" select="$source" as="element()"/>
<xsl:with-param name="multi-authors" select="cs:all/cs:multiple-authors" as="element(cs:multiple-authors)?"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
In this case, the source that it is looking at is:
<citation delimiter=";">
<prefix>(</prefix>
<first>
<multiple-authors min-authors="6" use-first="6">et al.</multiple-authors>
<layout>
<creator>
<names-short/>
<suffix> </suffix>
</creator>
<year/>
<point>
<prefix>: </prefix>
</point>
</layout>
</first>
<subsequent>
<multiple-authors min-authors="6" use-first="1"/>
</subsequent>
<suffix>)</suffix>
</citation>
Bruce
[xsl] Re: parameter oddness
Subject: [xsl] Re: parameter oddness From: Bruce D'Arcus <bdarcus@xxxxxxxxx> Date: Mon, 6 Jun 2005 12:19:57 -0400 |
On Jun 6, 2005, at 10:58 AM, Bruce D'Arcus wrote:
Nevermind. I've not quite figured out the problem, but I have figured out the parameter seems to not being passed in this circumstance.
Actually, I spoke too soon. The parameter is being passed, but it seems the text content of the element is not. Didn't even know that was possible!
The "when" branch of the choose within cs:first is working as expected, but the otherwise branch gives me the odd behavior (I can grab the attribute content from the templates the multi-author is passed to, but the element content is empty). Any suggestions?
<xsl:template match="cs:citation">
<xsl:param name="source" as="element()"/>
<xsl:param name="first-ref" as="xs:boolean"/>
<xsl:choose>
<xsl:when test="cs:first">
<xsl:choose>
<xsl:when test="$first-ref">
<xsl:apply-templates select="cs:first/cs:layout/cs:creator">
<xsl:with-param name="source" select="$source" as="element()"/>
<xsl:with-param name="multi-authors" select="cs:first/cs:multiple-authors" as="element(cs:multiple-authors)?"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="if (cs:subsequent/cs:layout) then (cs:subsequent/cs:layout/cs:creator)
else (cs:first/cs:layout/cs:creator)">
<xsl:with-param name="source" select="$source" as="element()"/>
<xsl:with-param name="multi-authors" select="if (cs:subsequent/cs:multiple-authors) then (cs:subsequent/cs:multiple-authors)
else (cs:first/cs:multiple-authors)" as="element(cs:multiple-authors)?"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="cs:all/cs:layout/cs:creator">
<xsl:with-param name="source" select="$source" as="element()"/>
<xsl:with-param name="multi-authors" select="cs:all/cs:multiple-authors" as="element(cs:multiple-authors)?"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
In this case, the source that it is looking at is:
<citation delimiter=";">
<prefix>(</prefix>
<first>
<multiple-authors min-authors="6" use-first="6">et al.</multiple-authors>
<layout>
<creator>
<names-short/>
<suffix> </suffix>
</creator>
<year/>
<point>
<prefix>: </prefix>
</point>
</layout>
</first>
<subsequent>
<multiple-authors min-authors="6" use-first="1"/>
</subsequent>
<suffix>)</suffix>
</citation>
Bruce
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] parameter oddness, Bruce D'Arcus | Thread | Re: [xsl] Re: parameter oddness, David Carlisle |
Re: [xsl] spacing issue, David Carlisle | Date | RE: [xsl] Source Reducer, tomas.vanek |
Month |