Re: [xsl] How to change a parameter value...

Subject: Re: [xsl] How to change a parameter value...
From: Claudio Russo <claudio_russo@xxxxxxxxx>
Date: Thu, 19 Jun 2003 06:47:37 -0700 (PDT)
Following is the code. See that I apply a fixed value
to the function "Ranking" and I want to change it
after it applies (that is, inside the stylesheet
before calling back again).

====================================================
<XML ID="XSLStyle2">
  <xsl:stylesheet version="1.0"
       
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        
  <xsl:param name="sexo"/>
  <xsl:param name="categ"/>
  <xsl:param name="anio"/>
  <xsl:param name="sortorder" select="'ascending'"/>
  <xsl:param name="sortfield" select="'posicion'"/>
  <xsl:param name="sorttipo" select="'text'"/>
  <xsl:template match="portfolio">
    <TABLE width="100%" cellspacing="0" border="0">
      <THEAD>
<!--        <TD width="70"><DIV class="header"
onClick="sort('anio')">Año</DIV></TD>
        <TD width="10"><DIV class="header"
onClick="sort('sexo')">Sexo</DIV></TD>
        <TD width="10"><DIV class="header"
onClick="sort('categoria')">Categ.</DIV></TD>
-->
        <TD width="50"><DIV class="header"
onClick="Ranking('posicion', 'ascending',
'number')">Posición</DIV></TD>
        <TD width="260"><DIV class="header"
onClick="Ranking('nombre', 'ascending',
'text')">Nombre</DIV></TD>
        <TD width="50"><DIV class="header"
onClick="Ranking('feder', 'ascending',
'text')">Feder.</DIV></TD>
        <TD width="50"><DIV class="header"
onClick="Ranking('nro_jugador', 'ascending',
'number')">Nro.Jugador</DIV></TD>
        <TD width="50"><DIV class="header"
onClick="Ranking('puntos', 'descending',
'number')">Puntos</DIV></TD>
      </THEAD>
      <xsl:for-each select="jugador[sexo=$sexo and
categoria=$categ and anio=$anio]">
<!--			<xsl:sort select="posicion" data-type="number"
order="ascending"/> -->
			<xsl:sort select="*[name()=$sortfield]"
data-type="{$sorttipo}" order="{$sortorder}"/>
        <TR>
<!--          <TD><DIV class="row"><xsl:value-of
select="anio"/></DIV></TD>
          <TD><DIV class="row"><xsl:value-of
select="sexo"/></DIV></TD>
          <TD><DIV class="row"><xsl:value-of
select="categoria"/></DIV></TD>
-->
          <TD><DIV class="row"
STYLE="text-align:right"><xsl:value-of
select="posicion"/></DIV></TD>
          <TD><DIV class="row"><xsl:value-of
select="nombre"/></DIV></TD>
          <TD><DIV class="row"><xsl:value-of
select="feder"/></DIV></TD>
          <TD><DIV class="row"
STYLE="text-align:center"><xsl:value-of
select="nro_jugador"/></DIV></TD>
          <TD><DIV class="row"
STYLE="text-align:right"><xsl:value-of
select="puntos"/></DIV></TD>
        </TR>
      </xsl:for-each>
    </TABLE>
  </xsl:template>

</xsl:stylesheet>
</XML>
====================================================

--- David Carlisle <davidc@xxxxxxxxx> wrote:
> 
> > Does anybody know how to change a parameter value?
> 
> You can't change the value of a global parameter
> within a stylesheet.
> (But that doesn't appear to be what you are trying
> to do)
> 
> > I want to change it to the oposite value (from
> > ascending to descending) onClic for the next time
> I
> > process the xslt, though I guess I need to know
> the
> > last value it had.
> 
> Presumably your stylesheet is writing some script
> into the html page to
> be activated by the onclic event. At the time it is
> writingthat html
> script it knows the current value of $sortorder so
> can write the script
> so as to call the stylesheet with a different value
> for the parameter,
> but the details will depend on exactly how you are
> re-calling the
> styleseet and what API you are using to access XSLT
> from a script etc..
> 
> David
> 
>
________________________________________________________________________
> This e-mail has been scanned for all viruses by Star
> Internet. The
> service is powered by MessageLabs. For more
> information on a proactive
> anti-virus service working around the clock, around
> the globe, visit:
> http://www.star.net.uk
>
________________________________________________________________________
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


=====
Regards, Claudio.

IT Consultant.
Buenos Aires, Argentina.
e-mail: claudio_russo@xxxxxxxxx


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Current Thread