Bonjour à tous,
Je travaille sur Oxygen XML Editor.
Je dois produire une transformation XML (conforme à la TEI: P5) vers HTML via XSLT.
Je me suis penchée sur les cours que j'ai suivi en classe ainsi que sur divers posts mais sans résultat.
Je suis toujours confrontée à deux problèmes :
1. je ne parviens pas à récupérer les attributs de mon XML (corr resp="Wikisource") ;
2. je ne parviens pas à bloquer une balise de mon XML (persName).
J'ai l'impression que cela vient soit :
- dans ma transformation XSLT de <xsl:template match="node()|@*"> ;
- soit de l'entête de mon document XML : <?xml-model [...] schematypens="http://relaxng.org/ns/structure/1.0"?> et <?xml-model [...] chematypens="http://purl.oclc.org/dsdl/schematron"?>.
Ai-je tord de vouloir ce résultat ? Si je transforme toutes mes balises en span et div, je ne pourrais plus différencier mes deux balises corr (je dois par la suite créer un index).
XML :
XSLT :
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 <?xml version="1.0" encoding="UTF-8"?> <?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> <?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?> <TEI xmlns="http://www.tei-c.org/ns/1.0"> <teiHeader> <fileDesc> <titleStmt> <title>Title</title> </titleStmt> <publicationStmt> <p>Publication Information</p> </publicationStmt> <sourceDesc> <p>Information about the source</p> </sourceDesc> </fileDesc> </teiHeader> <text> <body> <p> Il était une fois, il y a <choice> <corr resp="Wikisource">longtemps</corr> <corr resp="Furne">très longtemps</corr> </choice> un chat nommé <persName>Pouf</persName> à <geogName>Paris</geogName>. </p> </body> </text> </TEI>
SORTIE POUR HTML :
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 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:template match="/"> <html> <head> <title>Article</title> <link rel="stylesheet" type="text/css" href="Article.css"/> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="choice"> <choice> <xsl:apply-templates select="//corr"/> </choice> </xsl:template> <xsl:template match="corr[@resp='Wikisource']"> <corr resp="Wikisource"> <xsl:value-of select="."/> </corr> </xsl:template> <xsl:template match="corr[@resp='Furne']"> <corr resp="Furne"> <xsl:value-of select="."/> </corr> </xsl:template> <xsl:template match="persName"/> </xsl:stylesheet>
RÉSULTAT VOULU ?
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 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Article</title> <link rel="stylesheet" type="text/css" href="Article.css"> </head> <body><?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"><?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"> <TEI xmlns="http://www.tei-c.org/ns/1.0"> <teiHeader> <fileDesc> <titleStmt> <title>Title</title> </titleStmt> <publicationStmt> <p part="N">Publication Information</p> </publicationStmt> <sourceDesc default="false"> <p part="N">Information about the source</p> </sourceDesc> </fileDesc> </teiHeader> <text> <body> <p part="N"> Il était une fois, il y a <choice> <corr resp="Wikisource" instant="false">longtemps</corr> <corr resp="Furne" instant="false">très longtemps</corr> </choice> un chat nommé <persName instant="false" full="yes">Pouf</persName> à <geogName instant="false">Paris</geogName>. </p> </body> </text> </TEI> </body> </html>
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 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Article</title> <link rel="stylesheet" type="text/css" href="Article.css"> </head> <body> <TEI xmlns="http://www.tei-c.org/ns/1.0"> <teiHeader> <fileDesc> <titleStmt> <title>Title</title> </titleStmt> <publicationStmt> <p>Publication Information</p> </publicationStmt> <sourceDesc> <p>Information about the source</p> </sourceDesc> </fileDesc> </teiHeader> <text> <body> <p> Il était une fois, il y a <choice> <corr resp="Wikisource">longtemps</corr> <corr resp="Furne">très longtemps</corr> </choice> un chat nommé Pouf à <geogName>Paris</geogName>. </p> </body> </text> </TEI> </body> </html>
Partager