RE: [xsl] external var in XSL

Subject: RE: [xsl] external var in XSL
From: "Angel Gavin" <agavin@xxxxxx>
Date: Wed, 16 Mar 2005 14:31:05 +0100

I thought it was possible. I am not an XSLT guru (far from it), but I have
used that "trick" several times.

I've tried an example (using Xalan; see below) and it works.

Am I doing something wrong?


XML File

<?xml version="1.0" encoding="UTF-8"?>
	<chapter name="chapter1">This is chapter 1</chapter>
	<chapter name="chapter2">This is chapter 2</chapter>
	<chapter name="chapter3">This is chapter 3</chapter>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:param name="chapterNumber" select="'chapter3'"/>
	<xsl:template match="/">
		<xsl:for-each select="chapters/chapter[@name = $chapterNumber]">
						<xsl:value-of select="@name"/>
					<xsl:value-of select="."/>

HTML (output) File

	<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<body>This is chapter 3</body>

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: 16 March 2005 13:23
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] external var in XSL

	<xsl:template match="manual/chapter[@name=$chapterNumber]">

That's a syntax error in XSLT, you can not use variables in match


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