|
|
|
<xsl:template match="/">
<xsl:variable name="chanelLink" select="rss/channel/link"/>
<html>
<xsl:call-template name="data"></xsl:call-template>
</html>
</xsl:template>
<xsl:template name="data">
<a href="{$chanelLink}"><xsl:value-of select="rss/channel/title"/></a>
</xsl:template>
Salut,
Je crois qu'il faut que tu définisse chanelLink en dehors du template match, quite à ne lui donner sa valeur qu'à ce moment là... It is only by not paying one's bills that one can hope to live in the memory of the commercial classes. |
Ok, si je sort la variable du macth ça fontionne.
Mais en plus il faut que l'attibution de la variable soit conditionnel.
<xsl:choose>
<xsl:when test="rss/channel/configs/categorie != 'all'">
<xsl:variable name="chanelTitre" select="rss/channel/configs/categorie"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="chanelTitre" select="rss/channel/title"/>
</xsl:otherwise>
<xsl:choose>
<xsl:template match="/">
<html>
<xsl:call-template name="data"></xsl:call-template>
</html>
</xsl:template>
<xsl:template name="data">
<a href="{$chanelLink}"><xsl:value-of select="rss/channel/title"/></a>
</xsl:template>
Et la ça genere une erreur. |
Un truc comme ça ne marcherait pas aussi bien?
<xsl:variable name="chanelLink"/> <xsl:template match="/"> <xsl:variable name="chanelLink" select="rss/channel/link"/> <html> <xsl:call-template name="data"></xsl:call-template> </html> </xsl:template> <xsl:template name="data"> <a href="{$chanelLink}"><xsl:value-of select="rss/channel/title"/></a> </xsl:template> It is only by not paying one's bills that one can hope to live in the memory of the commercial classes. |
La variable du lien fonctionne, merci.
Mais pas celle du titre. Elle ne prend pas en compte que categorie != 'all'
<!-- le lien : ok -->
<xsl:variable name="chanelLink" select="rss/channel/link"/>
<!-- variable du titre -->
<xsl:variable name="chanelTitre"/>
<xsl:choose>
<xsl:when test="rss/channel/configs/categorie != 'all' ">
<xsl:variable name="chanelTitre" select="rss/channel/configs/categorie"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="chanelTitre" select="rss/channel/title"/>
</xsl:otherwise>
</xsl:choose>
<!-- Masque -->
<xsl:template match="/">
<html>
<head>
<title><xsl:copy-of select="$chanelTitre"/></title>
</head>
<body>
<xsl:call-template name="data"></xsl:call-template>
</body>
</html>
</xsl:template>
<xsl:template name="data">
<a href="{$chanelLink}"><xsl:value-of select="rss/channel/title"/></a>
</xsl:template>
|
Au fait pourquoi tu veux utiliser une variable?
It is only by not paying one's bills that one can hope to live in the memory of the commercial classes. |
Bon sans garantie mais un truc du genre ne marcherait pas?
<xsl:variable name="chanelTitre"> <xsl:choose> <xsl:when test="rss/channel/configs/categorie != 'all' "> rss/channel/configs/categorie </xsl:when> <xsl:otherwise> rss/channel/title </xsl:otherwise> </xsl:choose> </xsl:variable> Je me souviens que je m'étais battu avec ce genre de choses aussi... It is only by not paying one's bills that one can hope to live in the memory of the commercial classes. |
YESSS
Merci je galère la dessus depuis ce matin Trop cool |
| 15/06 14h12 | [access] Variable dans une requete sql | Programmation | 29/06 16h10 | 21 |
| 26/02 04h42 | Page d'accueil variable | Webmastering | 26/02 22h20 | 4 |
| 22/11 12h08 | [XSL]Modifier variables globales.... | Webmastering | 22/11 15h54 | 4 |
| 29/08 11h28 | XSL acces au nom des balises | Webmastering | 29/08 16h07 | 5 |