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

RE: [xsl] xsl data type problem? two values appear to be equal but ...


Subject: RE: [xsl] xsl data type problem? two values appear to be equal but ...
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 13 Dec 2005 16:12:15 -0000

This has nothing to do with data types: it's a context problem. The meaning
of a relative path expression like "@id" depends on the context node. In
your match pattern, @id is an attribute of a data-store element; in the
select expression, it is an attribute of a data-sink element.

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

> -----Original Message-----
> From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx] 
> Sent: 13 December 2005 15:59
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] xsl data type problem? two values appear to be 
> equal but ...
> 
> Here is the opening part of the problem template:
> --------------    
> <xsl:template match="data-store[@id=$node-id]">    
>     <node type="{local-name(.)}" id="{@id}" name="{name}">
> --------------
> This selects the node I expect. So far, so good.
> Now, further along in the template I pass a parameter to a 
> called template:
> 
> <xsl:with-param name="ds-predecessor" 
> select="/fssc/component-list/processes/process[data-sinks/data
> -sink[.=$node-id]]" />
> 
> This works, too, but if I define the parameter in this way, 
> no nodes are passed:
> 
> <xsl:with-param name="ds-predecessor" 
> select="/fssc/component-list/processes/process[data-sinks/data
> -sink[.=@id]]" />
> 
> The 'match' treats these two values as the same, but the 
> 'select' seems to treat them differently.I have output both 
> values using 'xsl:value-of' and they seem the same.  
> 
> I also used the compare() function on the two and got a 
> return value of '0'.My hypothesis is that they must be of 
> different data types and that's why the called template 
> behaves differently when called with one or the other. 
> 
> I have been searching the index of XPath 2.0 Programmer's 
> Reference looking for a function that will return the data 
> type of a node or variable passed to it, but I must have the 
> wrong idea of what I'm looking for, because I can't find one.
> 
> Will someone kindly tell me why these two are the same and 
> different? Thanks.
> 
> -- 
> Charles Knell
> cknell@xxxxxxxxxx - email


Current Thread
Keywords