music-encoding / encoding-tools

Tools for working with or transforming MEI Encodings
Educational Community License v2.0
41 stars 32 forks source link

Fails to re-encode MusicXML files via xsltproc #14

Closed odub closed 7 years ago

odub commented 7 years ago

I'm trying to convert MusicXML files to MEI using xsltproc.

For example:

xsltproc ../encoding-tools/musicxml2mei/musicxml2mei-2.3.xsl bwv2.6.xml -o output.mei

Whichever XSL I try I get a big list of errors.

Here's the file: bwv2.6.xml.zip

Am I doing something wrong?

odub commented 7 years ago

Maybe I should be running saxon instead? A working usage example would be really useful here.

pe-ro commented 7 years ago

Hi,

Sorry to see that you're having trouble with the conversion. Perhaps it's not as straightforward as it should be, but the process does work.

  1. You should be using the latest version of the MusicXML to MEI transform; that is, musicxml2mei-3.0.xsl. Also, since this XSLT uses Saxon extensions, you should be using Saxon, specifically v. 9.6.0.7.
  2. The musicxml2mei transformation expects the MusicXML file to be in the so-called "time-wise" form. To get to this from the more common "part-wise" form, use the parttime.xsl stylesheet provided in the MusicXML distribution.
  3. Running musicxml2mei.xsl against the output of step one results in an MEI 2013 file. You can use the mei21to30 stylesheet to "up convert" the 2013 output produced in step 2 to the latest version of MEI. However, the only modification needed to make it compliant is to change the value of @meiversion from "2013" to "3.0.0".

I've attached a zip file with a timewise version of your original file and the output of step 3, minus the change in @meiversion.

musicxml2mei_example.zip

odub commented 7 years ago

Great to have the extended instructions. Thanks!

odub commented 7 years ago

Two gotchas for anyone in future:

1) It seems like you need the paid version of Saxon (so, PE or EE) to run musicxml2mei-3.0.xsl. I installed this by modifying the homebrew formula to point at http://www.saxonica.com/download/SaxonPE9-6-0-7J.zip. You can get a free 30 day trial from Saxonica.

2) The source MusicXML files had doctype declarations pointing at no longer functional URLs. I got around this by referencing local files instead, for example:

<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.1 Partwise//EN"
                                "../../../library/musicxml30/partwise.dtd">