je bute sur le retour chariot et les espaces dans un div. Et de maniere generale, sur ce code :
Fichier xml : (c'est du code C documente en xml)
Fichier xsl :
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90 <?xml version="1.0" encoding="utf-8" standalone="yes"?> <root> <para>Ceci est un exemple de listing de program:</para> <para>Example: <programlisting> <codeline> <highlight class="preprocessor"> <sp/>#include<sp/><stdio.h></highlight> <highlight class="normal"/> </codeline> <codeline> <highlight class="normal"> <sp/> </highlight> </codeline> <codeline> <highlight class="normal"> <sp/> </highlight> <highlight class="keywordtype">int</highlight> <highlight class="normal"/> </codeline> <codeline> <highlight class="normal"> <sp/>main(</highlight> <highlight class="keywordtype">int</highlight> <highlight class="normal"> <sp/>argc,<sp/> </highlight> <highlight class="keywordtype">char</highlight> <highlight class="normal"> <sp/>**argv)</highlight> </codeline> <codeline> <highlight class="normal"> <sp/>{</highlight> </codeline> <codeline> <highlight class="normal"> <sp/> <sp/> <sp/>int<sp/>*ef;</highlight> </codeline> <codeline> <highlight class="normal"> <sp/> <sp/> <sp/> </highlight> <highlight class="keywordtype">char</highlight> <highlight class="normal"> <sp/>buf[1024],<sp/>*ret,<sp/>**list;</highlight> </codeline> <codeline> <highlight class="normal"> <sp/> <sp/> <sp/> </highlight> <highlight class="keywordtype">int</highlight> <highlight class="normal"> <sp/>size,<sp/>num,<sp/>i;</highlight> </codeline> <codeline> <highlight class="normal"> <sp/> </highlight> </codeline> <codeline> <highlight class="normal"> <sp/> </highlight> </codeline> <codeline> <highlight class="normal"> <sp/> <sp/> <sp/> </highlight> <highlight class="keywordflow">return</highlight> <highlight class="normal"> <sp/>0;</highlight> </codeline> <codeline> <highlight class="normal"> <sp/>}</highlight> </codeline> </programlisting> </para> </root>
quand j'envoie ca dans xt, je n'ai pas les retour a la ligne, le code C est sur une ligne. Normal, je n'en mets pas. Mais, j'ai essaye plein de trucs sans succes.
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
49
50
51
52
53
54 <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" indent="yes" version="1.0"/> <xsl:template match="root"> <xsl:apply-templates/> </xsl:template> <xsl:template match="programlisting"> <xsl:text>Mon PROG !!</xsl:text> <xsl:element name="div"> <xsl:attribute name="class"> <xsl:text>programlisting</xsl:text> </xsl:attribute> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="para"> <xsl:choose> <xsl:when test="not(./programlisting)"> <xsl:element name="p"> <xsl:apply-templates/> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="codeline"> <xsl:apply-templates/> <xsl:element name="br"/> </xsl:template> <xsl:template match="sp"> <xsl:text> </xsl:text> </xsl:template> <xsl:template match="highlight"> <xsl:element name="span"> <xsl:attribute name="class"> <xsl:value-of select="./@class"/> </xsl:attribute> <xsl:apply-templates/> </xsl:element> </xsl:template> </xsl:stylesheet>
Mais surtout, xt me fournit un html avec trop de retour a la ligne (faut mettre un element pre autour du code, pour bien s'en rendre compte)
si quelqu'un pouvait me dire:
1) comment mettre ces retours a la ligne (a la fin d'un "ligne de code C")
2) eviter tous ces retour chariot qui appraissent dans le code html et qui sont visibles des qu'on met un pre comme element (par exemple).
merci![]()
Partager