xsl-list
[Top] [All Lists]

RE: Parameter problem

2003-10-02 10:04:35
Hi

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Marsha Salo
Sent: Thursday, October 02, 2003 4:12 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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[(_at_)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[(_at_)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[(_at_)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



<Prev in Thread] Current Thread [Next in Thread>