I have this code on xslt 2.0.
<xsl:template match="results">
<xsl:choose>
<xsl:when test="result">
<xsl:if test="result/publication/@test='true'">
<div class="publication-wrapper">
<xsl:apply-templates/>
</div>
</xsl:if>
<xsl:if test="result/publication/@test='false'">
<div class="former-publication-wrapper">
<xsl:apply-templates/>
</div>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<div class="publication publication-label" >None</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="result">
<xsl:variable name="publication-uri" select="publication/@uri" />
<xsl:variable name="publication-label" select="publication/@label" />
<xsl:variable name="test" select="publication/@testdate" />
<div class="publication">
<div class="publication-label">
<a href="{ov:getPublicationURL($publication-uri)}"><xsl:value-of select="$publication-label" /></a>
</div>
.
.
.
</div>
</xsl:template>
I want to display my publications in the div publication-wrapper if $test in the template result is true and in former-publication-wrapper if it's false.
In the <xsl:when test="result"> i have tested several things. With <xsl:when test="result/publication/@test='true'">, i have publications, with something random like <xsl:when test="result/publication/@test='aaa'"> i don't have any publications. So I assume that in my xsl:when i can check if $test exists and its value. But with this code, i don't have any publications even if i know there are.
Aucun commentaire:
Enregistrer un commentaire