[XSLT 2.0] Problème de variable...
Bonjour,
A l'intérieur d'un template XSLT 2.0, j'ai défini une variable $children qui englobe un CALL TEMPLATE avec PARAMETRE à savoir :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
<xsl:variable name="children">
<xsl:call-template name="subMrow">
<xsl:with-param name="size" select="$size" />
<xsl:with-param name="aSize" select="$aSize" />
<xsl:with-param name="variant" select="$variant" />
<xsl:with-param name="color" select="$color" />
<xsl:with-param name="sizeMult" select="$sizeMult" />
<xsl:with-param name="minSize" select="$minSize" />
<xsl:with-param name="scriptLevel" select="$scriptLevel" />
<xsl:with-param name="displayStyle" select="$displayStyle" />
<xsl:with-param name="x" select="$x" />
<xsl:with-param name="y" select="$y"/>
<xsl:with-param name="noeuds" select="*" />
</xsl:call-template>
</xsl:variable> |
============================
Ensuite, je tente de récupérer des informations depuis la variable $children mais rien n'y fait.
Par exemple,
Code:
1 2 3 4 5 6 7 8 9 10 11
|
<!-- Create a variable named $maxHeight -->
<xsl:variable name="maxHeight">
<xsl:for-each select="$children/*">
<xsl:sort select="@tree:HEIGHT" data-type="number" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="@tree:HEIGHT" />
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:message>maxHeight : <xsl:value-of select="$maxHeight" /></xsl:message> |
---> maxHeight n'a pas de valeur dans ce cas.
UNE IDEE ? Je suis bloqué depuis deux jours et je n'en dors plus ;-)
=====
Pour mieux comprendre le contenu de la variable $children, voici le code du template subMrow qui a pour rôle de traiter le premier noeud et de s'appeller récursivement avec le reste des noeuds à traiter...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<!-- ###########################################################################
subMrow
################################################################################ -->
<xsl:template name="subMrow">
<xsl:param name="size" />
<xsl:param name="aSize" />
<xsl:param name="variant" />
<xsl:param name="color" />
<xsl:param name="sizeMult" />
<xsl:param name="minSize" />
<xsl:param name="scriptLevel" />
<xsl:param name="displayStyle" />
<xsl:param name="x" />
<xsl:param name="y" />
<xsl:param name="noeuds"/>
<xsl:if test="$noeuds">
<xsl:variable name="noeud" select="$noeuds[1]" />
<xsl:message>Subtree Visit : <xsl:value-of select="$noeud"/></xsl:message>
<xsl:message>x : <xsl:value-of select="$x"/></xsl:message>
<xsl:variable name="subTree">
<xsl:apply-templates select="$noeud" mode="formatting">
<xsl:with-param name="size" select="$size" />
<xsl:with-param name="aSize" select="$aSize" />
<xsl:with-param name="variant" select="$variant" />
<xsl:with-param name="color" select="$color" />
<xsl:with-param name="sizeMult" select="$sizeMult" />
<xsl:with-param name="minSize" select="$minSize" />
<xsl:with-param name="scriptLevel" select="$scriptLevel" />
<xsl:with-param name="displayStyle" select="$displayStyle" />
<xsl:with-param name="x" select="$x" />
<xsl:with-param name="y" select="$y"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="currentWidth">
<xsl:value-of select="$subTree/*/@tree:WIDTH"/>
</xsl:variable>
<xsl:message>subtree width : <xsl:value-of select="$currentWidth" /></xsl:message>
<xsl:call-template name="subMrow">
<xsl:with-param name="size" select="$size" />
<xsl:with-param name="aSize" select="$aSize" />
<xsl:with-param name="variant" select="$variant" />
<xsl:with-param name="color" select="$color" />
<xsl:with-param name="sizeMult" select="$sizeMult" />
<xsl:with-param name="minSize" select="$minSize" />
<xsl:with-param name="scriptLevel" select="$scriptLevel" />
<xsl:with-param name="displayStyle" select="$displayStyle" />
<xsl:with-param name="x" select="$x + $currentWidth" />
<xsl:with-param name="y" select="$y"/>
<xsl:with-param name="noeuds" select="$noeuds[position() > 1]"/>
</xsl:call-template>
</xsl:if>
</xsl:template> |
----
Merci pour votre aide !!!