Pour transformer un fichier avec des caracteres suédois j utilise le code suivant
Mon probleme vient du fait que je passe des paramètres à mon template qui sont
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:output encoding="ISO-8859-1" omit-xml-declaration="no"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/><!--récursivité--> </xsl:copy> </xsl:template> <xsl:template match="text()"> <!--åÅäÄöÖüÜ--> <xsl:call-template name="replaceText"> <xsl:with-param name="vString" select="."/> <xsl:with-param name="vChar" select="string('å')"/> <xsl:with-param name="vCharCode" select="'å'"/> </xsl:call-template> </xsl:template> <xsl:template name="replaceText"> <xsl:param name="vString"/> <xsl:param name="vChar"/> <xsl:param name="vCharCode"/> <xsl:choose> <xsl:when test="contains($vString, $vChar)"> <xsl:value-of select="substring-before($vString, $vChar)" /> <xsl:text></xsl:text> <xsl:value-of select="$vCharCode"/> <xsl:call-template name="replaceText"> <xsl:with-param name="vString" select="substring-after($vString, $vChar)"/> <xsl:with-param name="vChar" select="$vChar"/> <xsl:with-param name="vCharCode" select="$vCharCode"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:copy-of select="$vString"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
la transformation se passe bien mais au lieu d avoir le code en texte, il me remet le même caractère... 'å' (j ai essayé en mettant un autre caractere et le template s execute en remplacant le caractere donc il y a bien transformation)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <xsl:with-param name="vChar" select="string('å')"/> <!-- qui sera remplacer par--> <xsl:with-param name="vCharCode" select="'å'"/>
Je pense que ces caractèresme posent problème par la suite ds d autres xsl donc il faut absoluement que je trouve une solution
Merci bcp
exemlle de xhtml parsé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body lang="EN-GB" xml:lang="EN-GB"> <div class="titre"> <table border="0" cellspacing="0" cellpadding="0" style="margin-left:3.95pt; border-collapse:collapse;"> <tr> <td width="346" valign="top" style="width:259.4pt;padding:0cm 7.35pt 0cm 7.35pt"> <p class="titre"> <span lang="SV" xml:lang="SV">3.1<span style='font:7.0pt "Times New Roman"'> </span> </span> <span lang="SV" xml:lang="SV">åÅExemple de texte</span> </p> </td> </tr> </table> </div> </body> </html>
Partager