Un exemple très simple d'utilisation : vous souhaitez réaliser un simple tableau HTML et poser une simple class CSS une ligne sur deux, la fonction position() et xsl:attribute sont vos amis !
Admettons le flux XML suivant :
<?xml version="1.0" encoding="UTF-8"?> <root> <View> <wandiz> <staff> <id>1</id> <name>Laurent Bientz</name> </staff> <staff> <id>2</id> <name>Florian Collot</name> </staff> <staff> <id>3</id> <name>Kevin Lancien</name> </staff> <staff> <id>4</id> <name>Nicolas Nowak</name> </staff> <!-- ... --> </wandiz> </View> </root>
En XSL, la fonction position() renvoie l'indice (attention commence par 1) du noeud dans la collection ; xsl:attribute permet quand à lui de dynamiquement créer/surcharger un attribut HTML le précédant.
Il suffit donc de tester le modulo afin de surcharger la class du tr toutes les 2 lignes :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" xmlns="http://www.w3.org/1999/xhtml"> <xsl:template name="showWandiz"> <table class="team"> <tr> <th>ID</th> <th>NAME</th> </tr> <xsl:for-each select="//View/wandiz/staff"> <tr class="light"> <xsl:if test="position() mod 2 = 0"><xsl:attribute name="class">dark</xsl:attribute></xsl:if> <td><xsl:value-of select="id" /></td> <td><xsl:value-of select="name" /></td> </tr> </xsl> </table> </xsl:template> </xsl:stylesheet>
http://www.portable2016.top/p-laid-5820.html
http://www.portable2016.top/p-laid-1348.html
http://www.portable2016.top/p-laid-1954.html
http://www.portable2016.top/p-laid-585.html
http://www.portable2016.top/p-laid-5174.html
http://www.portable2016.top/p-laid-5314.html
http://www.portable2016.top/p-laid-3474.html
http://www.portable2016.top/p-laid-5825.html
http://www.portable2016.top/p-laid-5361.html
http://www.portable2016.top/p-laid-4078.html
http://www.portable2016.top/p-laid-4132.html
http://www.portable2016.top/p-laid-1234.html
http://www.portable2016.top/p-laid-8.html
http://www.portable2016.top/p-laid-2107.html
http://www.portable2016.top/p-laid-1222.html
http://www.ustylein.xyz/index.php?main_page=product_info&products_id=18700
http://www.ustylein.xyz/index.php?main_page=product_info&products_id=56683
http://www.importoutlet.xyz/index.php?main_page=product_info&products_id=26877
http://www.sheszakka.xyz/index.php?main_page=product_info&products_id=24207
http://www.needskokostore.xyz/index.php?main_page=product_info&products_id=54315
http://www.aucsurpass.xyz/index.php?main_page=product_info&products_id=27444
http://www.tokiwado.xyz/index.php?main_page=product_info&products_id=49717
http://www.ustylein.xyz/index.php?main_page=product_info&products_id=9413
http://www.mapollo.xyz/index.php?main_page=product_info&products_id=47631
http://www.ustylein.xyz/index.php?main_page=product_info&products_id=37696
authentic jersey wholesale
real nfl jerseys
NHL Jerseys Tampa Bay Lightning 91 Steven Stamkos Black
cheap nfl authentic jerseys wholesale
nfl jersey cheap
nfl cheap apparel
cheap team jerseys
Nike Eagles #10 DeSean Jackson White Mens NFL Elite Jersey
Majestic Athletic MLB San Francisco Giants Womens Orange Blended T-Shirt 018
Top MLB New York Yankees Snapback Hat NU27 Cheap Sale
Manchester United #5 Marcos Rojo Black Long Sleeves Soccer Club Jersey
MLB Jerseys Milwaukee Brewers 8 Ryan Braun grey
MLB Jerseys New York Mets 45 Martinez white blue stripe
http://www.cheapbestnfljerseys.top/p-laid-750.html
http://www.cheapbestnfljerseys.top/p-laid-39877.html
http://www.cheapbestnfljerseys.top/p-laid-54211.html
http://www.cheapbestnfljerseys.top/p-laid-67764.html
http://www.cheapbestnfljerseys.top/p-laid-94469.html
http://www.cheapbestnfljerseys.top/p-laid-101595.html
http://www.cheapbestnfljerseys.top/p-laid-120854.html
http://www.cheapbestnfljerseys.top/p-laid-152615.html
http://www.cheapbestnfljerseys.top/p-laid-173424.html
http://www.cheapbestnfljerseys.top/p-laid-196640.html
http://www.cheapbestnfljerseys.top/p-laid-206737.html
http://www.cheapbestnfljerseys.top/p-laid-235890.html
http://www.cheapbestnfljerseys.top/p-laid-253097.html
http://www.cheapbestnfljerseys.top/p-laid-277637.html
http://www.cheapbestnfljerseys.top/p-laid-287422.html
http://smartguard.co.il/have-issues-then-buy-college-essay-papers-2/
http://creativemeditationbd.com/?p=842
http://birmiligramnostalji.besaba.com/?p=1638
a few of the posts I realized it’s new to me. Regardless,
I’m definitely happy I came across it and I’ll be bookmarking it and checking back frequently!
Если у кого то есть проблемы с мужским здоровьем то заходите по ссылке
Сиалис Приобрести с доставкой. Загляните на наш сайт
https://potentia24.online/
1e9c1a255f36442aa274ee111a22155c
Apporter votre contribution