RE: [xsl] using xsl:message

Subject: RE: [xsl] using xsl:message
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 24 Oct 2004 19:07:55 +0100
You asked about the message indicating that the definition of global
variable $citation-class is circular.

It turns out that this is a secondary error due to incorrect recovery from
your first error. If you omit the citation-style parameter, or supply an
incorrect value, then the call on doc() fails. By default this is a
recoverable error, so Saxon carries on processing. However, at the time of
the failure it has set a flag indicating that the variable $citation-class
is being evaluated, and it fails to unset this flag on the error path, so
the next attempt to evaluate the variable checks the flag, believes that the
variable is already undergoing evaluation, and reports the circularity.

Since you defined the $styles variable as:

<xsl:variable name="styles" as="document-node()"
  select="doc(concat('../../styles/',$citation-style, '.csl'))" />

I think that a failure from the doc() function should be a fatal error, for
two reasons: (a) you used doc() rather than document(), which has different
error semantics in the spec (however, Saxon currently implements them the
same way), and (b) if it does fail, the result should be an empty sequence,
which doesn't match the "as" declaration of your variable. I'm therefore
looking into why this doesn't give you a type error, at the very least.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Bruce D'Arcus [mailto:bdarcus@xxxxxxxxxxxxx] 
> Sent: 18 October 2004 20:19
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] using xsl:message
> 
> 
> On Oct 18, 2004, at 8:43 AM, Michael Kay wrote:
> 
> > That suggests there's another error present which is 
> masking this one. 
> > Would
> > need to see more of the stylesheet to find it.
> 
> I condition a lot of the main ("mods:mods") templates on this 
> parameter 
> value.  So long as it's specified, the error goes away and everything 
> runs fine.  I really just want a clear message to give to the user so 
> they don't get confused.
> 
> In any case, current archive is here if you have time to look 
> (I'd love 
> feedback more generally from anyone out there, actually!), 
> though there 
> are a lot of files there.
> 
> 	http://www.users.muohio.edu/darcusb/files/xbiblio.tar.gz
> 
> The parameter is specified in xsl/xhtml/xbiblio.xsl, and is used in 
> files like "xsl/xhtml/render-classes/author-year/biblio-out.xsl", in 
> templates like:
> 
> <xsl:template 
> match="mods:modsCollection[$citation-class='author-year']"
> 	      mode="bibliography">
> 
> Bruce

Current Thread