[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|