![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 13 Pomógł: 0 Dołączył: 25.11.2003 Ostrzeżenie: (0%) ![]() ![]() |
Witam, mam pewien problem z umieszczeniem warunków sortowania rekordów, nie wiem czy użyłem dobrych znaczników i w dobrych miejscach, ale próbowałem na wiele sposobów i nie było porządanego efektu
![]() Chcę sortować rekordy np. według numer. plik.xml [xml:1:083e6c80e7] <?xml version="1.0" encoding="UTF-16"?> <?xml-stylesheet type='text/xsl' href='my_xslt.xsl' ?> <STRONA nazwa="Przykładowe wpisy"> <WPIS> <numer>1</numer> <autor>Autor nr.1</autor> <tresc>Ten autor promuje coca-cole</tresc> <mail>nr12o2.pl</mail> <www>www.coke-coke.pl</www> </WPIS> <WPIS> <numer>2</numer> <autor>Autor_2</autor> <tresc>pepsi rulez</tresc> <mail>nik@wp.pl</mail> <www>ale jaja</www> </WPIS> </STRONA> [/xml:1:083e6c80e7] my_xslt.xsl [xml:1:083e6c80e7] <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="STRONA"> <html> <head> <title>Przegląd wpisów - <xsl:value-of select="@nazwa"/></title> <!-- Style dla strony --> <style> @media all { body { background-color: #CCCCCC; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; } a:link { text-decoration:none; color: #00cc33; } .tabela_01 { background-color: #FFFFFF; font-family: Arial; font-size: 15px; } .tabela_autor { background-color: #666666; font-family: Arial; color: #cccccc; font-size: 13px; } .tabela_autor_kolor { background-color: #666666; font-family: Arial; color: #FFFFFF; font-size: 13px; font-weight: bold; } .tabela_tresc { font-family: Arial; color: #666666; font-size: 12px; } .tabela_mail { background-color: #666666; font-family: Arial; color: #FFFFFF; font-size: 12px; font-weight: normal; position: static; } } </style> </head> <body> <table cellpadding="0" cellspacing="0" border="0" width="100%" align="100%"> <table cellpadding="0" cellspacing="0" border="0" width="500px" align="center" class="tabela_01"> <tr> <td align="center" height="30px"> <b> <xsl:value-of select="@nazwa"/> </b> </td> </tr> </table> <!-- Wyświtlanie i sortowanie elementów ????--> <xsl:apply-templates> <xsl:for-each select="autor" > <xsl:sort case-order="Descending"/> </xsl:for-each> </xsl:apply-templates> </table> </body> </html> </xsl:template> <!-- Wygląd poszczególnych elementów --> <xsl:template match="WPIS"> <table cellpadding="0" cellspacing="0" border="1" width="500px" align="center"> <tr> <td class="tabela_autor"> <table cellpadding="0" cellspacing="0" border="0" width="500px"> <tr><td height="2"></td></tr> <tr> <TD width="5"></TD> <TD width="100"><b>Nr: </b> <span class="tabela_autor_kolor"><xsl:value-of select="numer" /> </span></TD> <TD width="5"></TD> <TD width="*"><b>Autor: </b><span class="tabela_autor_kolor"><xsl:value-of select="autor"/></span></TD> </tr> <tr><td height="2"></td></tr> </table> </td> </tr> <TR> <TD class="tabela_tresc"> <table cellpadding="0" cellspacing="0" border="0" width="500px"> <tr><td height="5"></td></tr> <tr> <TD width="5"></TD> <TD width="490"><b>Treść: </b> <xsl:value-of select="tresc" /></TD> <TD width="5"></TD> </tr> <tr><td height="5"></td></tr> </table> </TD> </TR> <TR> <TD class="tabela_mail"> <xsl:variable name="mail"> <xsl:value-of select="mail"/> </xsl:variable> <table cellpadding="0" cellspacing="0" border="0" width="500px"> <tr><td height="5"></td></tr> <tr> <TD width="5"></TD> <TD width="490">E-mail: <a href="mailto:{$mail}"> <xsl:value-of select="$mail"/></a></TD> <TD width="5"></TD> </tr> <tr><td height="5"></td></tr> </table> </TD> </TR> <TR> <TD class="tabela_mail"> <xsl:variable name="www"> <xsl:value-of select="www"/> </xsl:variable> <table cellpadding="0" cellspacing="0" border="0" width="500px"> <tr><td height="5"></td></tr> <tr> <TD width="5"></TD> <TD width="490">WWW: <a href="$www"> <xsl:value-of select="$www"/></a></TD> <TD width="5"></TD> </tr> <tr><td height="5"></td></tr> </table> </TD> </TR> </table> <table cellpadding="0" cellspacing="0" border="0" width="500px" align="center"> <tr><td height="5"></td></tr> </table> <!-- match="WPIS" --> </xsl:template> </xsl:stylesheet> [/xml:1:083e6c80e7] ktoś wie jak t powinno wyglądać??? |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 18.07.2025 - 00:55 |