[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: accessing last element of node set passed as param

Subject: Re: accessing last element of node set passed as parameter
From: "paul morgan" <pmorg@xxxxxxxxx>
Date: Tue, 21 May 2002 12:31:02 -0700
selecting last element xsl
Thanks Joerg.  I had come up with my solution borrowing from a response from Michael Kay to a question I had about recursively building up a nodeset.  Following is Michael's code:

    <xsl:template name="build">
      <xsl:param name="n"/>
      <xsl:param name="tree"/>
      <xsl:call-template name="build">
         <xsl:with-param name="n" select="$n+1"/>
         <xsl:with-param name="tree">
           <xsl:copy-of select="$tree"/>
           <a i="{$n}"/>
         </xsl:with-param>
      </xsl:call-template>
    </xsl:template>

I had assumed it was building a nodeset ... but obviously (except to me) not.

Paul
--

On Tue, 21 May 2002 21:15:11  
 Joerg Heinicke wrote:
>Hello Paul,
>
>you're again creating a RTF and must convert it to a node-set. Either in 
>your "A" template or by changing the apply-templates again:
>
><xsl:variable name="tmp">
>   <xsl:copy-of select="$result"/>
>   <BAR i="{$i}"/>
></xsl:variable>
><xsl:apply-templates select="following-sibling::*[1]">
>   <xsl:with-param name="result" select="xalan:nodeset($tmp)"/>
></xsl:apply-templates>
>
>Regards,
>
>Joerg
>
>paul morgan schrieb:
>> Thanks David!  Some of this is starting to click ... but then again something happens that shuts the clicker down.
>> 
>> Since order is important to me, I decided to heed your warning about the ordering of a union being implementation dependent, so I set about making all of the "BAR" elements be siblings of one another.  I replaced:
>> 
>>     <xsl:apply-templates select="following-sibling::*[1]">
>>         <xsl:with-param name="result" select="$result|xalan:nodeset($new)"/>
>>     </xsl:apply-templates> </xsl:template> 
>> 
>> with:
>> 
>>     <xsl:apply-templates select="following-sibling::*[1]">
>>         <xsl:with-param name="result">
>>             <xsl:copy-of select="$result"/>
>>             <BAR i="{$i}"/>
>>         </xsl:with-param>
>>     </xsl:apply-templates> </xsl:template> 
>> 
>> but now I get the following error message:
>> 
>>     Can not convert #RTREEFRAG to a NodeList!
>> 
>> at the line:
>> 
>>     <xsl:copy-of select="($result/BAR)[last()]" />
>> 
>> the first time the "A" template is matched with a non-empty value for "result".  Shouldn't "result" be a node set?
>> 
>> Paul (I think this language is going to make my head explode)
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


________________________________________________________
Outgrown your current e-mail service?
Get a 25MB Inbox, POP3 Access, No Ads and No Taglines with LYCOS MAIL PLUS.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.