[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Number comparison vs. string comparison


Subject: [xsl] Number comparison vs. string comparison
From: Unico Hommes <Unico@xxxxxxxx>
Date: Mon, 23 Apr 2001 16:43:46 +0200

Hello everybody,

I have a small question.

I have the following xsl :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
	<xsl:variable name="var" select="" />
	<xsl:template match="/item">
		<xsl:if test="@id = $var">
			do something
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

I use the following asp code to preprocess this xsl before applying it to
transform my xml file :

var avariable;
var astring = "astring";
var anumber = 0;

somevariable = astring;
//somevariable = anumber;

var xsl = Server.CreateObject("MSXML2.DOMDocument");

xsl.load(xsl_location);
xsl.selectSingleNode("//xsl:variable[0]/@select/").value = somevariable;

Now the problem is if I use somevariable variable to hold a number my code
will work, but if I try to put a string in there the xsl doesn't even hold
the variable in its $var variable. I tested it trying to print it out from
within my xsl with <xsl:value-of select="$var" />

Am I doing something wrong ?

Thanx,

Unico

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords