IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XSL/XSLT/XPATH XML Discussion :

Création d'un fichier XSL pour formatter des données


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Candidat au Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mai 2012
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2012
    Messages : 9
    Points : 4
    Points
    4
    Par défaut Création d'un fichier XSL pour formatter des données
    Bonjour à tous. Tout d'abord, je vais vous présenter ce que je dois faire. Mon programme Java permet de me générer un fichier XML grâce à la librairie Simple. Depuis ce fichier XML, je le formate en XSL pour obtenir un format MusicXML (standard de création de partition sur le net). Depuis ce fichier MusicXML, j'aimerais le formatter à nouveau pour obtenir un fichier Lilypond (.ly) pour permettre, par la suite, la génération d'un PDF de cette partition.

    J'ai un petit problème pour le 2ème XSL entre MusicXML & Lilypond.

    Voici mes 2 fichiers :

    MusicXML

    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
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
    <score-partwise>
    	<work>
    		<work-number>Date: 4 février 2012</work-number>
    		<work-title>Exercice 1</work-title>
    	</work>
    	<identification>
    		<creator type="composer">Herbert von Karajan</creator>
    	</identification>
    	<part-list>
    		<score-part id="P1">
    			<part-name>Main droite</part-name>
    		</score-part>
    		<score-part id="P2">
    			<part-name>Main gauche</part-name>
    		</score-part>
    		<score-part id="P3">
    			<part-name>Main tête</part-name>
    		</score-part>
    	</part-list>
    	<part id="P1">
    		<measure number="1">
    			<attributes>
    				<divisions>2</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>4</beats>
    					<beat-type>4</beat-type>
    				</time>
    				<clef>
    					<sign>percussion</sign>
    					<line>2</line>
    				</clef>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    		</measure>
    		<measure number="2">
    			<attributes>
    				<divisions>3</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>6</beats>
    					<beat-type>8</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    				<notehead>x</notehead>
    			</note>
    		</measure>
    		<measure number="3">
    			<attributes>
    				<divisions>2</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>4</beats>
    					<beat-type>4</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    		</measure>
    		<measure number="4">
    			<attributes>
    				<divisions>3</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>9</beats>
    					<beat-type>8</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<barline location="right">
    				<bar-style>light-heavy</bar-style>
    			</barline>
    		</measure>
    	</part>
    	<part id="P2">
    		<measure number="1">
    			<attributes>
    				<divisions>2</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>4</beats>
    					<beat-type>4</beat-type>
    				</time>
    				<clef>
    					<sign>percussion</sign>
    					<line>2</line>
    				</clef>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    		</measure>
    		<measure number="2">
    			<attributes>
    				<divisions>3</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>6</beats>
    					<beat-type>8</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    		</measure>
    		<measure number="3">
    			<attributes>
    				<divisions>2</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>4</beats>
    					<beat-type>4</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    		</measure>
    		<measure number="4">
    			<attributes>
    				<divisions>3</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>9</beats>
    					<beat-type>8</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<barline location="right">
    				<bar-style>light-heavy</bar-style>
    			</barline>
    		</measure>
    	</part>
    	<part id="P3">
    		<measure number="1">
    			<attributes>
    				<divisions>2</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>4</beats>
    					<beat-type>4</beat-type>
    				</time>
    				<clef>
    					<sign>percussion</sign>
    					<line>2</line>
    				</clef>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    		</measure>
    		<measure number="2">
    			<attributes>
    				<divisions>3</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>6</beats>
    					<beat-type>8</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    				<notehead>x</notehead>
    			</note>
    		</measure>
    		<measure number="3">
    			<attributes>
    				<divisions>2</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>4</beats>
    					<beat-type>4</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    			<note>
    				<rest/>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>2</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<notehead>x</notehead>
    			</note>
    		</measure>
    		<measure number="4">
    			<attributes>
    				<divisions>3</divisions>
    				<key>
    					<fifths>0</fifths>
    					<mode>major</mode>
    				</key>
    				<time>
    					<beats>9</beats>
    					<beat-type>8</beat-type>
    				</time>
    				<staff-details>
    					<staff-lines>1</staff-lines>
    				</staff-details>
    			</attributes>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<note>
    				<rest/>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    			</note>
    			<note>
    				<pitch>
    					<step>B</step>
    					<octave>4</octave>
    				</pitch>
    				<duration>3</duration>
    				<voice>1</voice>
    				<type>quarter</type>
    				<dot/>
    				<notehead>x</notehead>
    			</note>
    			<barline location="right">
    				<bar-style>light-heavy</bar-style>
    			</barline>
    		</measure>
    	</part>
    </score-partwise>

    Résultat souhaité Lilypond

    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
    	\version "2.14.2"	
    		\header {
    		title = " Exercice 1 "
    		subtitle = " Date: 4 février 2012 "
    		composer = " Herbert von Karajan "
    		}
     
    		Maindroite = \relative c' {
    				\set Staff.instrumentName = #"Main droite"
    				\override NoteHead #'style = #'cross
     
    				\time 4/4 r4 c4 c4 r4 
    				\time 6/8 r4. c4. 
    				\time 4/4 r4 r4 c4 c4 
    				\time 9/8 r4. c4. r4.  \bar "|." 
    			}
     
     
    		Maingauche = \relative c' {
    				\set Staff.instrumentName = #"Main gauche"
    				\override NoteHead #'style = #'cross
     
    				\time 4/4 c4 r4 r4 c4 
    				\time 6/8 c4. r4. 
    				\time 4/4 c4 r4 r4 r4 
    				\time 9/8 c4. r4. r4.  \bar "|." 
    			}
     
     
    		Maintête = \relative c' {
    				\set Staff.instrumentName = #"Main tête"
    				\override NoteHead #'style = #'cross
     
    				\time 4/4 r4 c4 r4 c4 
    				\time 6/8 r4. c4. 
    				\time 4/4 r4 c4 r4 c4 
    				\time 9/8 r4. r4. c4.  \bar "|." 
    			}
     
     
     
    				\score { 
    			<<
     
    			\new RhythmicStaff  \Maindroite
     
    			\new RhythmicStaff  \Maingauche
     
    			\new RhythmicStaff  \Maintête>>
            }

    Voici le début de mon fichier XSL. Le début était facile, mais une fois que j'arrive à essayer de récupérer les temps/notes, je n'arrive pas à obtenir les bonnes informations. Dois-je utiliser un template ?
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
     
    <xsl:template match="score-partwise">
    	\version "2.14.2"
    		\header {
    		title = " <xsl:value-of select="work/work-title"/> "
    		subtitre = " <xsl:value-of select="work/work-number"/> "
    		composer = " <xsl:value-of select="identification/creator"/> "
    		}
    		<xsl:for-each select="part-list/score-part">
    			<xsl:value-of select="part-name"/> = \relativ c' {
    			\set Staff.instrumentName = #"<xsl:value-of select="part-name"/>
    			\override NoteHead #'style = #'cross
    			\time <xsl:value-of select="beats"/>
    		</xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Le résultat actuel du formattage me donne ceci :
    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
    <?xml version="1.0" encoding="UTF-8"?>
    	\version "2.14.2"
    		\header {
    		title = " Symphonie des harengs "
    		subtitre = " 23.05.2012 "
    		composer = " Triton d'amésythe "
    		}
    		Main Gauche = \relativ c' {
    			\set Staff.instrumentName = #"Main Gauche
    			\override NoteHead #'style = #'cross
    			\time 4 4 4 4 4 4
    		Main Droite = \relativ c' {
    			\set Staff.instrumentName = #"Main Droite
    			\override NoteHead #'style = #'cross
    			\time 4 4 4 4 4 4
    		Tête = \relativ c' {
    			\set Staff.instrumentName = #"Tête
    			\override NoteHead #'style = #'cross
    			\time 4 4 4 4 4 4
    Je constate que je n'obtiens pas seulement 1 "beats", mais tous les "beats" du XML...

  2. #2
    Membre émérite Avatar de tsuji
    Inscrit en
    Octobre 2011
    Messages
    1 558
    Détails du profil
    Informations forums :
    Inscription : Octobre 2011
    Messages : 1 558
    Points : 2 736
    Points
    2 736
    Par défaut
    D'abord le xslt ne semble pas capable de résulter pas la ligne \time... avec les chiffres, non, même pas. Il doit résulte du vide après. Mais, peu import, il est incorrect de toute façon.

    Et puis, je dirais qu'il est important de faire contrôler les espaces beaucoup plus rigoreusement, d'autant plus pour les cas ou les documents résultant sont des fichiers de texte et non-xml. Les quelques mesures que je prends dans le code ci-desous sont pour ce but-ci, donc, ne vous étonnez pas la bizarrie apparante.

    Voici un rendement partiel qui résulte la partie 4/4 ou 6/8 etc... mais pas celles de r4 ou c4 etc parceque je ne vois pas très clair la logique et vous devriez y compléter un peu moins difficilement après ayant vu les constructions montrées alentour.
    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
    <xsl:param name="space" select="' '" />
    <xsl:param name="linebreak" select="'&#x0d;&#x0a;'" />
    <xsl:param name="tab" select="'&#x09;'" />
    <xsl:variable name="lb-t" select="concat($linebreak,$tab)" />
    <xsl:variable name="lb-t-t" select="concat($lb-t,$tab)" />
    <xsl:variable name="lb-t-t-t" select="concat($lb-t-t,$tab)" />
    <xsl:template match="score-partwise">
        <xsl:value-of select="$tab" />
        <xsl:text>\version "2.14.2"</xsl:text>
        <xsl:value-of select="$lb-t-t" />
        <xsl:text>\header {</xsl:text>
        <xsl:value-of select="$lb-t-t" />
        <xsl:text>title = " </xsl:text>
        <xsl:value-of select="work/work-title"/>
        <xsl:text> "</xsl:text>
        <xsl:value-of select="$lb-t-t" />
        <xsl:text>subtitre = " </xsl:text>
        <xsl:value-of select="work/work-number"/>
        <xsl:text> "</xsl:text>
        <xsl:value-of select="$lb-t-t" />
        <xsl:text>composer = " </xsl:text>
        <xsl:value-of select="identification/creator"/>
        <xsl:text> "</xsl:text>
        <xsl:value-of select="$lb-t-t" />
        <xsl:text>}</xsl:text>
        <xsl:value-of select="$lb-t-t" />
     
        <xsl:for-each select="part-list/score-part">
            <xsl:value-of select="part-name"/>
            <xsl:text> = \relativ c' {</xsl:text>
            <xsl:value-of select="$lb-t-t-t" />
            <xsl:text>\set Staff.instrumentName = #"</xsl:text>
            <xsl:value-of select="part-name"/>
            <xsl:value-of select="$lb-t-t-t" />
            <xsl:text>\override NoteHead #'style = #'cross</xsl:text>
            <xsl:value-of select="$linebreak" />
            <xsl:apply-templates 
                select="ancestor::score-partwise/part[@id=current()/@id]/measure" 
                mode="proc"
            />
            <xsl:value-of select="$lb-t-t" />
            <xsl:text>}</xsl:text>
            <xsl:value-of select="$linebreak" />
            <xsl:value-of select="$lb-t-t" />
        </xsl:for-each>
    </xsl:template>
     
    <xsl:template match="measure" mode="proc">
        <xsl:value-of select="$lb-t-t-t" />
        <xsl:text>\time </xsl:text>
        <xsl:value-of select="concat(attributes/time/beats,'/',attributes/time/beat-type)" />
        <xsl:value-of select="$space" />
        <!-- récupérer espace-séparé data pour les rests c4 r4 etc  -->
    </xsl:template>

Discussions similaires

  1. Réponses: 4
    Dernier message: 21/08/2007, 14h09
  2. [MySQL] utilisé un fichier XML pour stocker des données ?
    Par italiasky dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 05/05/2007, 11h04
  3. création d'une requette pour inscrire des données
    Par jeanjean555 dans le forum Access
    Réponses: 9
    Dernier message: 04/02/2007, 19h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo