xsl-list
[Top] [All Lists]

RE: xsl:sort in old MSXML

2003-07-01 05:10:55
Oops. I forgot the code:

<body onLoad="Titulos()"><table border="0" width="100%" cellspacing="1">
  <tr>
    <td width="100%">
      <div align="center">
        <center><table border="0" width="100%" cellspacing="4" height="592">
        <tr>
          <td width="100%" align="center" height="1">
                <!-- XML ID="xmlRanking" SRC="ranking_sorter.xml"></XML -->
                     <DIV ID="divResults" /></DIV>
          </td>
        </tr>
        <tr>
          <td width="100%" align="center" height="468">
                                                <DIV ID="divResultados" /></DIV>
          </td>
        </tr>
      </table>
      </div>
      </center></td>
  </tr>
</table>

<XML ID="XSLHeader">
  <xsl:stylesheet version="1.0"  
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:js="javascript:code"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:ms="urn:schemas-microsoft-com:xslt"
        xmlns:fo="http://www.w3.org/1999/XSL/Format";>

        <msxsl:script language="javascript" implements-prefix="js">
        
        function totalReg(node, anio, sexo, categ)
        {
                total = 0;
      //        return "/jugador[sexo='" + sexo + "' and categoria=" + categ + 
" and anio=" + anio + "]"
          jugadores = node.selectNodes("/portfolio/[sexo='" + sexo + "' and 
categoria=" + categ + " and anio=" + anio + "]");
          for (v = jugadores.nextNode(); v; v = jugadores.nextNode())
            total += 1;
          return formatNumber(total, "#");
        }

        </msxsl:script>

                <xsl:param name="sexo"/>
                <xsl:param name="categ"/>
                <xsl:param name="anio"/>
                
                <xsl:template match="portfolio">
                
                <head>
                </head>
                <table border="2" width="100%" height="6">
                        <tr>
                        <td class="bg">
                        <H1><xsl:value-of select="description"/> del 
<xsl:value-of select="$anio"/> - <xsl:value-of select="$categ"/> Años, 
                                        <xsl:choose>
                                                        <xsl:when 
test="$sexo='V'">Varones</xsl:when>
                                                                
<xsl:otherwise>Damas</xsl:otherwise>
                                                        </xsl:choose>
                                                        
                                                </H1>
                        <H3>Actualizado el <xsl:apply-templates select="date"/>
                                                </H3>
<!--                                            <H3>Factorial <xsl:value-of 
select="js:factorial(6)"/>
                                                </H3> -->
                                                <DIV>Total de Jugadores: 
<B><xsl:value-of select="count(jugador[sexo=$sexo and categoria=$categ and 
anio=$anio])"/></B></DIV>
                                                <P>Presione sobre los 
encabezados para ordenar por dicho campo ascendente o descendentemente.</P>
                        </td>
                        </tr>
        </table>
                </xsl:template>
  
                <xsl:template match="date">
                <xsl:value-of select="ms:format-date(., 'd', SP_ar)"/> de 
<xsl:value-of select="ms:format-date(., 'MMMMM, yyyy', SP_ar)"/>
                        a las <xsl:value-of select="ms:format-time(., 'hh:mm 
tt')"/>
                </xsl:template>

        </xsl:stylesheet>
</XML>

<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', 
'{$sortorder}', 'number')">Posición</DIV></TD>
        <TD width="260"><DIV class="header" onClick="Ranking('nombre', 
'{$sortorder}', 'text')">Nombre</DIV></TD>
        <TD width="50"><DIV class="header" onClick="Ranking('feder', 
'{$sortorder}', 'text')">Feder.</DIV></TD>
        <TD width="50"><DIV class="header" onClick="Ranking('nro_jugador', 
'{$sortorder}', 'number')">Nro.Jugador</DIV></TD>
        <TD width="50"><DIV class="header" onClick="Ranking('puntos', 
'{$sortorder}', '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>


-----Original Message-----
From: Claudio Russo 
Sent: Martes, 01 de Julio de 2003 09:02 a.m.
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] xsl:sort in old MSXML


Michael,

I have the code that follows. 
In my machine I have IE 6.0, and MSXML 4.0. 

1) Does the code that shows will not be able to be executed by, let say, 
Netscape or any other browser? 
2) Does for instance a user of IE 6.0 be able to view the results and one of IE 
4.0 not?
3) Which is the best approach to develop in a neutral environment that be 
accesible for everyone (or at least 90% of the www users, not an enterprise 
environment, where will be easy to install all the set up required)?
4) Why do we talk of different engines like Saxon, MS, etc.? 

Claudio.

-----Original Message-----
From: Michael Kay [mailto:mhk(_at_)mhk(_dot_)me(_dot_)uk]
Sent: Lunes, 30 de Junio de 2003 02:57 p.m.
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] xsl:sort in old MSXML



I'm trying to use the XML support in the MSXML version 
distributed with IE5.0 (which MSXML version is it by the way, 
I'm guessing 2.0 or 2.5). 

So, I'm trying to use xsl:sort but the script engine tells me 
that I cannot use the keyword xsl:sort where I use it.

Tried the following approaches:
<xsl:apply-templates select="//question">
  <xsl:sort select="@id" order="ascending" 
data-type="number"/> </xsl:apply-templates>

and
<xsl:for-each select="//question">
    <xsl:sort select="@id" order="ascending" 
data-type="number"/> </xsl:for-each>

None of these seems to work.
Exact error message is: Keyword xsl:sort may not be used here.

The same things happens when I try to use xsl:param and 
xsl:variable as well.

BTW, the namespace declaration in my stylesheet is: 
xmlns:xsl="http://www.w3.org/TR/WD-xsl";

Does anyone have any idea what to do?


It's a long while since we've seen this, it used to come up twice a day.

WD-xsl is not XSLT. You can't get a C compiler to process Java, and you
can't get a WD-xsl processor to process XSLT. They are different
languages. If you want to write XSLT, you will need an XSLT processor.

Michael Kay


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


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



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