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

Re: variable question

Subject: Re: variable question
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 31 Aug 2004 13:33:08 +0100
Re:  variable question
Hi Bruce,

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

Sorry, my fault. You'd indicated that you have two kinds of
<mods:titleInfo> elements: ones with <mods:relatedItem> parents and
ones without. You wanted the different <mods:titleInfo> elements
treated differently. I'd given you XSLT 1.0 code to deal with that,
but when I transposed it to XSLT 2.0, I'd overlooked the fact that the
parameter you were passing into the mods:reftype() function might be
an empty sequence. (This didn't matter in the XSLT 1.0 code because
you never declare types in XSLT 1.0.)

One solution is to declare the parameter of the function so that it
accepts an empty sequence. Instead of:

  <xsl:param name="relatedItem" as="element(mods:relatedItem)" />

which says that $relatedItem must be one-and-only-one
<mods:relatedItem> element, use:

  <xsl:param name="relatedItem" as="element(mods:relatedItem)?" />

which says that $relatedItem must be zero-or-one <mods:relatedItem>
element.

Another solution would be not to call the function if the parent of
the <mods:titleInfo> element isn't a <mods:relatedItem> element.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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.