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

RE: variable question

Subject: RE: variable question
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 31 Aug 2004 08:59:57 +0100
xsl if empty sequence
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.

Michael Kay

> -----Original Message-----
> From: Bruce D'Arcus [mailto:bdarcus@xxxxxxxxxxxxx]
> Sent: 31 August 2004 04:32
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  variable question
>
> I'm getting the following error on the below:
>
> 	An empty sequence is not allowed as the first argument of
> mods:reftype()
>
> What does this mean in this context?  That the function is getting
> confused trying to find the right node?
>
> Bruce
>
> On Aug 29, 2004, at 4:32 PM, Jeni Tennison wrote:
>
> > For XSLT 2.0, I think I'd turn the reftype template into a function
> > instead, since it just returns a string. I'd keep the title-before
> > template as a template since it might return some XML when
> you revise
> > it in the future. So it would look more like:
> >
> > <xsl:template match="mods:titleInfo[not(@type='abbreviated')]"
> >               mode="bibliography">
> >   <span class="{if (../mods:relatedItem[@type = 'host'])
> >                 then 'title'
> >                 else 'title italic'}">
> >     <xsl:apply-templates select="." mode="title-before"/>
> >    	<xsl:apply-templates select="mods:title"/>
> >    	<xsl:apply-templates select="mods:subTitle"/>
> >    	<xsl:apply-templates select="." mode="title-after"/>
> >   </span>
> > </xsl:template>
> >
> > <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: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>

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.