Re: [xsl] variable question

Subject: Re: [xsl] variable question
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Tue, 31 Aug 2004 07:15:01 -0400
On Aug 31, 2004, at 6:03 AM, David Carlisle wrote:

However teh system doesn't agree with you, there's no point in asking
us
to guess, just find out what it is:

It reported a number of these messages: parent is [[mods]]


The output was incorrect, though, so I modified the function like so:

<xsl:function name="mods:reftype" as="xs:string">
  <xsl:param name="bibref" as="element(mods:mods)" />
  <xsl:choose>
    <xsl:when test="$bibref/mods:relatedItem/@type = 'host'">
      <xsl:variable name="issuance"

select="$bibref/mods:relatedItem//mods:originInfo/mods:issuance" />
      <xsl:choose>
        <xsl:when test="$issuance = 'continuing'">article</xsl:when>
        <xsl:when test="$issuance = 'monographic'">chapter</xsl:when>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>book</xsl:otherwise>
  </xsl:choose>
</xsl:function>

Now, if I use this template, it runs through and I get the correct
output:

<xsl:template match="mods:titleInfo" mode="title-before">
  <xsl:choose>
  <xsl:when test="not(parent::mods:mods)">
<xsl:message>
parent is [[<xsl:value-of select="name(..)"/>]]
</xsl:message>
  </xsl:when>
  <xsl:otherwise>
  <xsl:if test="mods:reftype(parent::mods:mods) = 'chapter'">
    <xsl:text></xsl:text>
  </xsl:if>
  </xsl:otherwise>
  </xsl:choose>
</xsl:template>

However, if I use this instead:

<xsl:template match="mods:titleInfo" mode="title-before">
  <xsl:if test="mods:reftype(parent::mods:mods) = 'chapter'">
    <xsl:text></xsl:text>
  </xsl:if>
</xsl:template>

.... I get this error:

 An empty sequence is not allowed as the first argument of
mods:reftype()
Transformation failed: Run-time errors were reported

???

Bruce

Current Thread