This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Monsieur, j'ai rencontre un problem avec template XSLT pour automatiquement generer des valeur dans lecas 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 exempledonc comme vous m'avez propose j'ai ecrit un template recursiveavec 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?



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]