[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Monsieur, j'ai rencontre un problem avec template XSLT pour automatiquement generer des valeur dans le cas fichier XML: Author 1 Author 2 Author 3 ............................ avec A soit un balise au chemin Xpath /html/body/table/tr/td[1],/html/body/table/tr/td[2],/html/body/table/tr/td[3],... par exemple donc comme vous m'avez propose j'ai ecrit un template recursive avec les parametre suivant: path: Chemin XPath (ne contient pas la portion index): /html/body/table/tr/td index: nombre d'ordre de ce balise : 1,2,3,4,... Mais le problem est: le chemin Xpath n'est pas valeur String donc on ne peut pas "concat" : $path,'[',$index,']' pour creer un nouveau chemin XPath pour l'appel de template prochaine. Si on les transmet des valeurs string: on ne peut pas effectuer operations comme: pour extrait la valeur dans Web Page? Convert valeur String to XPath expression?


Subject: [xsl] Monsieur, j'ai rencontre un problem avec template XSLT pour automatiquement generer des valeur dans le cas fichier XML: <A> Author 1</A> <A> Author 2</A> <A> Author 3</A> ............................ avec A soit un balise au chemin Xpath /html/body/table/tr/td[1],/html/body/table/tr/td[2],/html/body/table/tr/td[3],... par exemple donc comme vous m'avez propose j'ai ecrit un template recursive avec les parametre suivant: path: Chemin XPath (ne contient pas la portion index): /html/body/table/tr/td index: nombre d'ordre de ce balise : 1,2,3,4,... Mais le problem est: le chemin Xpath n'est pas valeur String donc on ne peut pas "concat" : $path,'[',$index,']' pour creer un nouveau chemin XPath pour l'appel de template prochaine. Si on les transmet des valeurs string: on ne peut pas effectuer operations comme: <xsl value-of select = $path> pour extrait la valeur dans Web Page? Convert valeur String to XPath expression?
From: CAO Tuan Dung <Tuan-Dung.Cao@xxxxxxxxxxxxxxx>
Date: Wed, 12 Jun 2002 11:38:08 +0200


I meet this problem when i try to write a template to extract automatique values in XML which have the chemin Xpath similars.


for example:

  <A> Author 1</A>
  <A> Author 2</A>
  <A> Author 3</A>
  ............................

avec A soit un balise au chemin Xpath /html/body/table/tr/td[1],/html/body/table/tr/td[2],/html/body/table/tr/td[3],...


So I have a template :



<xsl:template name="GetAllAuthor"> <xsl:param name="path" /> <xsl:param name="index" /> <xsl:param name="openning"/> <xsl:param name="closing"/> <xsl:variable name="titi" select="concat($path,'[',$index,']')"/>

<xsl:choose>
<xsl:when test="string-length($titi) = 0" />
<xsl:otherwise>
<xsl:value-of select="$openning" disable-output-escaping="yes"/>
<xsl:value-of select="$titi" disable-output-escaping="yes"/>
<xsl:value-of select="$closing" disable-output-escaping="yes"/>


<xsl:call-template name="GetAllAuthor">
<xsl:with-param name="path" select="$path" />
<xsl:with-param name="index" select="$index+1" />
<xsl:with-param name="openning" select="$openning" />
<xsl:with-param name="closing" select="$closing" />
</xsl:call-template> </xsl:otherwise>


</xsl:choose>
</xsl:template>

and the file XSLT to test
<xsl:template match="/">
<HTML>
<BODY>
<xsl:call-template name= "GetAllAuthor">
<xsl:with-param name="path" select="'/html/body/blockquote/div[1]/font/a'" />
<xsl:with-param name="index" select="1"/>
<xsl:with-param name="openning" select="concat('&lt;','c:Author','&gt;','&#10;','&lt;','c:Name','&gt;','&#10;')" />
<xsl:with-param name="closing" select="concat('&lt;','/','c:Name','&gt;','&#10;','&lt;','/','c:Author','&gt;','&#10;')"/>
</xsl:call-template>
</BODY>
</HTML>
</xsl:template>sl:template>


but the out put is not correct because the value of $path is Xpath expression and can not combine with a String?
So if any one can help me?
Thanks alot. Have a good day.















path: Chemin XPath (ne contient pas la portion index): /html/body/table/tr/td
index: nombre d'ordre de ce balise : 1,2,3,4,...



Mais le problem est: le chemin Xpath n'est pas valeur String donc on ne peut pas
"concat" : $path,'[',$index,']' pour creer un nouveau chemin XPath pour l'appel de template prochaine.


Si on les transmet des valeurs string: on ne peut pas effectuer operations comme:

<xsl value-of select = $path> pour extrait la valeur dans Web Page?


Donc je ne sais pas on peut resoudre ce problem ?




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Keywords