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

RE: external var in XSL

Subject: RE: external var in XSL
From: "Angel Gavin" <agavin@xxxxxx>
Date: Wed, 16 Mar 2005 14:55:18 +0100
RE:  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="http://www.w3.org/1999/XSL/Transform">
	<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:  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:
http://www.star.net.uk
________________________________________________________________________


______________________
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

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.