Bonjour,

je dois implémenter une transformations xslt 1 dans une page php qui se présente ainsi:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
	$xq = new xqueryBP();
	$fragment = $xq->getFragmentSelonSaCoteEtSonNumero_v3($ref_bib_doc, $ref_bib_num_frag);
	$xml2=new DOMDocument();
	$xml2->loadXML('<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="path/templates/xsl/13_03_2012/PP_V2_1_fragment/xsl/normalise_v4.xsl"?>'.$fragment);
 
	$xsl2=new DOMDocument();
	$xsl2->load(PATH_APPLICATION.'/templates/xsl/13_03_2012/PP_V2_1_fragment/xsl/normalise_v4.xsl', LIBXML_NOCDATA);
	$proc2 = new XSLTProcessor();
	$proc2->importStylesheet($xsl2);
echo $proc2->transformToXml($xml2);
Mon xml, retournée par la méthode, getFragmentSelonSaCoteEtSonNumero_v3():
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
<text><term xmlns="http://www.tei-c.org/ns/1.0" xmlns:dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0" dbp:hand="EL-encre" rend="underline" rendition="#entete-page">Exaltation <lb/>du
            bas</term><term xmlns="http://www.tei-c.org/ns/1.0" xmlns:dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0" dbp:hand="GF-encre" rend="underline">Vampirisme</term><term xmlns="http://www.tei-c.org/ns/1.0" xmlns:dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0" dbp:hand="GF-encre">Le peuple plus fort <lb/>que les
                Savants.</term><item xmlns="http://www.tei-c.org/ns/1.0" type="fragment" n="5"><cit xmlns:dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0" dbp:hand="EL-encre"><quote><del><note type="selection" dbp:hand="GF-crayon">[</note><seg type="selection-crochet">Les hommes en butte au vampirisme sont donc vraiment
                  <lb/>possédés par les morts, et</seg><note type="selection" dbp:hand="GF-crayon">]</note></del><note type="regie" dbp:hand="GF-encre" place="above" xml:id="n2_g226_1_f_094__r____" prev="#n1_g226_1_f_094__r____">(2)</note> le peuple,
              avec son bon sens, a vu <lb/>plus clair en cette matière <add dbp:hand="GF-encre" place="below">(le vampirisme)</add> que les Savants avec leur esprit <lb/>sceptique
              - <note type="regie" dbp:hand="GF-encre" xml:id="n3_g226_1_f_094__r____" next="#n4_g226_1_f_094__r____">(3)</note></quote><bibl xml:id="b5999-3"><hi rend="underline">Goërres</hi> - Mystique. <choice><abbr type="conventionnel">Vol.</abbr><expan>Vol<ex>ume</ex></expan></choice> III. <choice><abbr type="conventionnel">Ch.</abbr><expan>Ch<ex>apitre</ex></expan></choice> XIV. <choice><abbr type="conventionnel">p.</abbr><expan>p<ex>age</ex></expan></choice> 252</bibl></cit></item></text>
C'est-a-dire une partie d'un document xml-TEI.
Les feuilles xsl, normalise_v4.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<xsl:stylesheet 
    xmlns:tei="http://www.tei-c.org/ns/1.0"
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    exclude-result-prefixes="tei xsl"
    version="1.0">
 
    <xsl:import href="commun_v4.xsl"/>
 
    <xsl:template name="css">
        <link rel="stylesheet" type="text/css" href="./style/tei_v4.css"/>
        <link rel="stylesheet" type="text/css" href="./style/tei-normalise_v4.css"/>
    </xsl:template>
 
    <!--notes critiques qui n'apparaissent pas-->
     <xsl:template match="tei:note[@type='DBP-footnote']"/>
    <xsl:template name="footnotes"/>
 
    <xsl:template name="fragment-header">
        <!--<span class="title">[ <xsl:value-of select="@n"/> ]</span>-->		
    </xsl:template>
 
    <xsl:template match="tei:abbr|tei:expand|tei:reg|tei:ex">
        <span>
            <xsl:attribute name="class">
                <xsl:value-of select="name()" />
                <xsl:call-template name="xml_atts"/>
                <xsl:call-template name="other_atts"/>
            </xsl:attribute>
            <xsl:apply-templates/>
        </span>
    </xsl:template>
 
    <!--choice-->
 
    <xsl:template match="tei:choice">
 
        <xsl:choose>
 
            <xsl:when test="tei:abbr[@type='conventionnel']">
                <xsl:choose>
                    <xsl:when test="tei:reg">
                        <xsl:apply-templates select="tei:reg[last()]"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:apply-templates select="tei:abbr"/>
                    </xsl:otherwise>
                </xsl:choose>                              
            </xsl:when>   
 
            <xsl:when test="tei:abbr[@type='conventionnel'] and tei:expan and tei:reg">  
                <xsl:apply-templates select="tei:abbr"/>              
            </xsl:when>
 
            <xsl:when test="tei:abbr and tei:expan and tei:reg">
                <xsl:apply-templates select="tei:reg"/>              
            </xsl:when>
 
            <xsl:when test="tei:abbr and tei:expan">
                <xsl:apply-templates select="tei:expan"/>              
            </xsl:when>
 
            <xsl:when test="tei:orig and tei:reg">
                <xsl:apply-templates select="tei:reg"/>               
            </xsl:when>      
 
            <xsl:when test="tei:sic and tei:corr">
                <xsl:apply-templates select="tei:corr"/>               
            </xsl:when> 
 
            <xsl:otherwise>
                <xsl:apply-templates/>
            </xsl:otherwise>
 
        </xsl:choose>
 
    </xsl:template> 
 
    <!--gap-->  
    <xsl:template match="tei:gap" />
 
    <!--supplied-->
    <xsl:template match="tei:supplied" >
 
        <span>
            <xsl:attribute name="class">
                <xsl:value-of select="name()" />
                <xsl:call-template name="xml_atts"/>
                <xsl:call-template name="other_atts"/><xsl:text> </xsl:text>
                <xsl:if test="@reason">reason</xsl:if><xsl:text> </xsl:text>
                <xsl:if test="contains(@reason, 'decoupe')"></xsl:if>
            </xsl:attribute>
 
            <xsl:apply-templates />
 
          </span>
 
    </xsl:template>
 
    <!--lb, del, non traités en norm-->
    <xsl:template match="tei:lb">
        <xsl:text> </xsl:text>
    </xsl:template>
 
    <xsl:template match="tei:del" />
 
    <xsl:template match="tei:c[@type='hyphen-orig']"/>
 
    <xsl:template match="tei:bibl[@xml:id]">
 
        <xsl:variable name="bibl-site"><xsl:value-of select="@xml:id"/></xsl:variable>
        <a class="ref-bibl" href="http://dossiers-flaubert.ish-lyon.cnrs.fr/{$bibl-site}">
            <br/>
            <span>
                <xsl:attribute name="class">
                    <xsl:value-of select="name()" />-norm
                    <xsl:call-template name="xml_atts"/>
                    <xsl:call-template name="other_atts"/>
                    <xsl:call-template name="delSpan"/>
 
                </xsl:attribute>
 
                <xsl:apply-templates/>
            </span>
        </a>
    </xsl:template>   
 
</xsl:stylesheet>
commun_v4.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="tei">
    <xsl:output indent="yes" method="xml" encoding="UTF-8" />

    <xsl:template match="comment() | processing-instruction()"/>
    
    <xsl:include href="variables.xsl" />
    <xsl:template match="/tei:TEI">
        
        
        <html>
            
            <head>
                <title>
                    <xsl:value-of select="normalize-space(//tei:titleStmt/tei:title[1])"/>
                    
                </title>
                
                
                <xsl:call-template name="css"/>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            </head>
            <body>
            <xsl:apply-templates select="tei:text/tei:body/tei:list"/>
            
            
            </body>
        </html>
    </xsl:template>
    
    <xsl:template name="xml_atts">
        <xsl:attribute name="id">
            <xsl:text></xsl:text><xsl:value-of select="@xml:id"/>
        </xsl:attribute>
        
        <!-- autres attributs xml éventuels -->
    </xsl:template>
    
    <xsl:template name="other_atts">
        <xsl:for-each select="@*">
            <xsl:text> </xsl:text><xsl:value-of select="local-name(.)"/>-<xsl:value-of select="translate(., '#()', '')"/>   
        </xsl:for-each>
        <xsl:for-each select="@dbp:*">
            <xsl:text> </xsl:text><xsl:value-of select="local-name(.)"/>-<xsl:value-of select="translate(., '#()', '')"/>   
        </xsl:for-each>
    </xsl:template>	

    <xsl:template match="tei:label|tei:label[tei:del]|tei:label[tei:term]|tei:head[tei:term]">
        
        <xsl:choose>
            <xsl:when test="tei:term/@rendition">
                <h1>
                    <xsl:attribute name="class">
                        <xsl:call-template name="xml_atts"/>
                        <xsl:call-template name="other_atts"/>
                        <xsl:call-template name="delSpan"/>
                        <xsl:call-template name="addSpan"/>
                    </xsl:attribute>
                    <xsl:apply-templates />
                </h1>
            </xsl:when>
            <xsl:otherwise>
                <h3>
                    <xsl:attribute name="class">
                        <xsl:call-template name="xml_atts"/>
                        <xsl:call-template name="other_atts"/>
                        <xsl:call-template name="delSpan"/>
                        <xsl:call-template name="addSpan"/>
                    </xsl:attribute>
                    <xsl:apply-templates />
                </h3>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <xsl:template name="delSpan">
        <xsl:variable name="delSpanTo">
            <xsl:value-of select="translate(preceding::tei:delSpan[1]/@spanTo,'#','')"/>
        </xsl:variable>
        <xsl:if test="following::tei:anchor[1][@xml:id=$delSpanTo]"><xsl:text> </xsl:text><xsl:value-of select="preceding::tei:delSpan[1]/@rend"/></xsl:if>
    </xsl:template>
    
    <xsl:template name="addSpan">
        <xsl:variable name="addSpanTo">
            <xsl:value-of select="translate(preceding::tei:addSpan[1]/@spanTo,'#','')"/>
        </xsl:variable>
        <xsl:if test="following::tei:anchor[1][@xml:id=$addSpanTo]"><xsl:text> </xsl:text><xsl:value-of select="preceding::tei:addSpan[1]/@type"/></xsl:if>
    </xsl:template>
    
    <xsl:template match="tei:item">
        
        <p>
            <xsl:attribute name="class">
                <xsl:call-template name="xml_atts"/>
                <xsl:call-template name="other_atts"/>
                <xsl:call-template name="delSpan"/>
                <xsl:call-template name="addSpan"/>
                
                <xsl:if test="@type='fragment'">
                    <xsl:text> </xsl:text>fragment
                </xsl:if>
            </xsl:attribute>
            
            <span class="fragment-header">
                <xsl:if test="@type='fragment'">
                    <xsl:call-template name="fragment-header"/>
                </xsl:if>
                <xsl:apply-templates select="tei:note[@type='DBP-footnote']" />
            </span>
            <span class="fragment-body">
                <xsl:apply-templates select="*[not(@type='DBP-footnote')]" />
            </span>	
        </p>
    </xsl:template>
    
    <!--infos d'en-tête-->
    <xsl:template match="tei:abbr|tei:c|tei:milestone|tei:hi|tei:cit|tei:bibl|tei:quote|tei:term|tei:note|tei:g|tei:add|tei:unclear|tei:addSpan|tei:supplied|tei:p|tei:seg">
        <span>
            <xsl:attribute name="class">
                <xsl:value-of select="name()" />
                <xsl:call-template name="xml_atts"/>
                <xsl:call-template name="other_atts"/>
            </xsl:attribute>
            <xsl:apply-templates/>
        </span>
    </xsl:template>

</xsl:stylesheet>
et variables.xsl:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="tei">
 
	<xsl:variable name="survol-appel-note">Note</xsl:variable>
 
	<!-- survol icone retour d'une note de bas de page vers le fragment correspondant -->
	<xsl:variable name="survol-retour-fragment">Retour haut</xsl:variable>
	<xsl:variable name="retour-fragment">Retour</xsl:variable>
</xsl:stylesheet>
J'ai indiqué en gras où se produisait les erreurs, et en rouge les éléments qui, selon moi, en sont la cause (cf commun_v4.xsl). Je pense que cela doit venir des namespaces, de la source xml ou du processeur de libxslt2; mais impossible de décider!?

Pour l'instant, rien ne 'affiche à part si je commente les appels à ces templates.


Merci de votre aide.