xsl-list
[Top] [All Lists]

Re: parameter oddness

2005-06-06 09:19:57

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


--~------------------------------------------------------------------
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>