RE: [xsl] Option mystery

Subject: RE: [xsl] Option mystery
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 13 Dec 2006 22:00:45 -0000
> <xsl:choose>
>   <xsl:when test="$tier/option[option-num=$cur-option-num and 
> @rate-increase='true']">
>     <option rate-increase="{@rate-increase}">
>        <debug1>branch1</debug1>
>         ...other elements
>      </option>
>    </xsl:when>
> </xsl:choose>
> 
> A few questions regarding snippet:
> 1) is that "option" a predefined XSLT1.0 construct / keyword 
> / operation ?

If you mean the option written as "<option rate-increase..." then it is a
literal result element: an element to be copied to the result.

> I can't find any in the XSLT book.

Look in the index under "literal result element".
> 
> 2) the bug I am trying to fix is that somehow on exit I am 
> getting a node with <option rate-increase="false"> (that 
> debug1=branch1 and
> option-num=1).  How is that possible ?   That "branch1" is unique and
> can't come from any other place. How can that expression 
> inside [] fail ?

Perhaps you're confused because the predicate can only return true if
@rate-increase is "true", whereas the value that's output is "false". But
the two occurrences of @rate-option are evaluated with different context
nodes, so you're looking at two different attributes.


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

Current Thread