This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Variables


> <xsl:variable name="n">2</xsl:variable>
> ...
> <xsl:value-of select="item[$n]"/>
> (See chapter 11.2)
>
> What is the reason for outputing the value of only the first item element ?

<xsl:value-of select="?"/> always returns the first value when the select
returns a node-set so this behavior is not exceptional. Nor is it difficult
to understand that the particular form of <xsl:variable ...> returns
a result tree fragment. But what I find difficult myself is why the 
result tree fragment can be placed in the predicate since chapter 11.1
specifically prohibits this:

   "In particular, it is not permitted to use the 
   /, // and [] operators on result tree fragments"

My guess is that the predicate [$n] is being converted to a boolean
value of true and the predicate therefore selects all items. The 
<xsl:value-of> is merely returning the first item in the node set.

Thats my theory.

Regards,

Dan


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]