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

RE: Parameter problem

Subject: RE: Parameter problem
From: Americo Albuquerque <melinor@xxxxxxxx>
Date: Thu, 2 Oct 2003 18:04:35 +0100
xsl apply templates parameter problem
Hi

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Marsha Salo
> Sent: Thursday, October 02, 2003 4:12 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Parameter problem
> 
> 
> 
> Hi Michael
> 
> >Does $firstN have a value in the PartyList/When [1] template?
>  yes.
> >Is the PartyList/When [last()] template actually being called?
>  yes.
> 
> >If so, something very odd is going on. Tell us which 
> processor you are 
> >using, and post a complete stylesheet + source document so 
> we can debug 
> >it for you.
> 	 I am using MSXML not sure about the processor. If i 
> have an xml parser do i automatically have a processor aswell?
> 	I am using xmlSpy to step through the transformation 
> process. At the bottom of this mail is the html output i am getting.
> 

The problem is not the param but where it is passed

On the <xsl:template match="PartyList"> template
You have <xsl:apply-templates select="When[@Attendance]">
This will select ALL <When> elements with a @Attendance attribute

In your <xsl:template match="PartyList/When[1]"> template you allso have
A <xsl:apply-templates select="following-sibling::When [last()]">
This will select the last following-sibling::When element

In the output you'll have:
 When[1] - firstN set
 When[last] - firstN set
 When[...]
 When[last] - firstN not set - this one is selected in the PartyList
template and, as sush, doesn't have the param set

You could set the parameter in the PartyList templates like:
  <xsl:apply-templates select="When[@Attendance]">
    <xsl:sort data-type="number" order="ascending"
select="@Attendance"/>
    <xsl:with-param name="first" select="When[1]/@Attendance"/>
  </xsl:apply-templates>

Or you can change the select so you only select the first When like:
  <xsl:apply-templates select="When[@Attendance][1]">
    <xsl:sort data-type="number" order="ascending"
select="@Attendance"/>
  </xsl:apply-templates> 
And let the When[1] template call the last one

Regards,
Americo Albuquerque



 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.