Batch transforming XML files in the database

Sometimes you need to make the same changes to many or all of your MEI documents. Typical changes are text replacements (if, for instance, your project changes its name or address), but also more complex, structural changes are possible. Using an XSL transformation for such tasks often is more efficient than editing all the documents by hand. Instead of downloading all of your files, transforming them locally on your computer, and upload them back to the server, MerMEId offers a script to do such a transformation directly on the server.
Please note, however, that due to software limitations transformations cannot make any changes to the documents' root element (that is, <mei>), such as changing the meiversion attribute. To migrate your data to newer MEI versions, therefore, you will need to download your data, transform them locally and upload them to the new database.

Prior to using the script, an XSLT style sheet making the desired changes must be placed somewhere where your server has access to it.

The script is located in the 'tools' folder in your eXist database: batch_transform_settings.xq.

The server may prompt you for an administrator password in order to give you access to the script. You should see the following form. It includes basic instructions and suggests default settings in some of the fields:

Batch transform

Fill in the form to define which files to select. The recommended default location of the XSLT style sheets is (http://[your-server]/exist/rest/db/mermeid/tools/batch_xsl/), i.e. in your eXist database, but your style sheet may also be located outside of the database or on some other server. Click the 'Search files' button to get a list of files matching the search criteria. Possibly not all files will actually be changed – that depends on your XSL transformation. The list only indicates the files that the script will attempt to transform.

Hit the 'Transform' button to run the transformation.

After the transformation process – if the connection did not time out – a result page will list the files changed and those that were unaffected by the transformation.