RE: [xsl] external var in XSL

Subject: RE: [xsl] external var in XSL
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 16 Mar 2005 14:36:25 -0000
Xalan, as far as I know, has always permitted variable references in match
patterns, despite the fact that the spec says it's an error; and after this
length of time (especially as it's permitted in XSLT 2.0) I would think it's
unlikely that they will change this.

I would categorize this as a "known non-conformance" rather than a bug, in
the sense that they almost certainly made a conscious decision to deviate
from the spec here.

Michael Kay 

> -----Original Message-----
> From: Angel Gavin [mailto:agavin@xxxxxx] 
> Sent: 16 March 2005 13:55
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] external var in XSL
> David,
> Thanks a lot for your valuable feedback. This has been my 
> first intervention
> in the list. Not very successful, I must say. You are right 
> and I am wrong
> (well, at least I was right when I said I am not a guru!)
> I've just discovered my answer was not exactly about the 
> issue you have
> pointed out (it works, though).
> Nevertheless, the problem is still the same. The following 
> stylesheet works
> in Xalan v1.4.0:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="";>
> 	<xsl:output method="html" version="1.0" 
> encoding="UTF-8" indent="yes"/>
> 	<xsl:param name="chapterNumber" select="'chapter3'"/>
> 	<xsl:template match="chapters/chapter[@name = $chapterNumber]">
> 		<html>
> 			<head>
> 				<title>
> 					<xsl:value-of select="@name"/>
> 				</title>
> 			</head>
> 			<body>
> 				<xsl:value-of select="."/>
> 			</body>
> 		</html>
> 	</xsl:template>
> </xsl:stylesheet>
> I do not get any error. I do not control what to do with "chapter1 and
> chapter2 elements", but it produces the desired effect. In 
> other words, it
> does not complain about including
> <xsl:template match="chapters/chapter[@name = $chapterNumber]">.
> I run xalan from XML Spy. The funny thing is that, when using 
> Altova's XSLT
> engine, it gives me an error that is completely in line with 
> your comment
> ("Variables and parameters cannot be used in variables"). The 
> same happens
> with MSXML.
> Since I am more used to xalan, I guess it is a bit more (much 
> too?) flexible
> with this. Maybe it is a bug actually.
> To be honest, I am using xalan v1.4.0, and last release is  
> 1.9. Maybe this
> bug (if any) has been fixed yet (I will check it asap).
> Nevertheless, the solution in my previous mail seems to make 
> more sense for
> me (and seems to be correct!).
> Regards,
> Angel
> -----Original Message-----
> From: David Carlisle [mailto:davidc@xxxxxxxxx]
> Sent: 16 March 2005 14:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] external var in XSL
> > I've tried an example (using Xalan; see below) and it works.
> that is a xalan bug then.
> > Am I doing something wrong?
> yes you can not use variable or param references in match patterns.
> David
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> ______________________________________________________________
> __________
> ______________________
> Este mensaje, y en su caso, cualquier fichero anexo al mismo,
>  puede contener informacion clasificada por su emisor como 
> confidencial
>  en el marco de su Sistema de Gestion de Seguridad de la 
> Informacion siendo para uso exclusivo del destinatario, quedando 
> prohibida su divulgacion copia o distribucion a terceros sin la 
> autorizacion expresa del remitente. Si Vd. ha recibido este mensaje 
>  erroneamente, se ruega lo notifique al remitente y proceda a 
> su borrado. 
> Gracias por su colaboracion.
> ______________________
> This message including any attachments may contain confidential 
> information, according to our Information Security Management System,
>  and intended solely for a specific individual to whom they 
> are addressed.
>  Any unauthorised copy, disclosure or distribution of this message
>  is strictly forbidden. If you have received this 
> transmission in error,
>  please notify the sender immediately and delete it.
> ______________________

Current Thread