xsl-list
[Top] [All Lists]

RE: variable question

2004-08-31 03:18:51
Using the trace() function can be useful to determine what the actual value
of an expression is. Alternatively, temporarily remove the type check and
add some logic to the called function to display details such as
count($relatedItem).

If you're really stuck, send me the full source and stylesheet and I'll try
and diagnose it for you.

Michael Kay 

-----Original Message-----
From: Bruce D'Arcus [mailto:bdarcus(_at_)myrealbox(_dot_)com] 
Sent: 31 August 2004 10:55
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] variable question

On Aug 31, 2004, at 3:59 AM, Michael Kay wrote:

If the relevant function call is the one shown, it means that the 
parent of
the mods:titleInfo context item is not a mods:relatedItem element, 
therefore
the function has been called with an empty sequence as the 
argument, 
which
is not allowed given the way you have declared the parameter.

Here's source fragment.

     <relatedItem type="host">
       <titleInfo>
      <title>Newsweek</title>
       </titleInfo>

No matter how I adjust the argument on the template below, I get the 
same error. So I don't understand what's going on.

<xsl:function name="mods:reftype" as="xs:string">
   <xsl:param name="relatedItem" as="element(mods:relatedItem)" />
   <xsl:choose>
     <xsl:when test="$relatedItem/@type = 'host'">
       <xsl:variable name="issuance" as="xs:string"
         select="$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>

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


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