Page 1 of 1

pretty printing multiple files

Posted: Mon Jun 30, 2014 8:51 pm
by immanuel
Hi,
I'd like to pretty print multiple XML files. There is this very useful button that applies pretty printing on the currently opened file. However, I would like to apply pretty rpinting on a whole folder without opening each of its XML-files.

I see one work around by defining an XSL-transformation scenario containing the copy template and an <output indent="yes"/>. But then I can't see how I could configure indention rules like I could do in oXygen's Preferences/Editor/Format/XML.

Is there a away to have this configurable formatting applicable on several files in a batch?

Regards
Immanuel

Re: pretty printing multiple files

Posted: Tue Jul 01, 2014 11:47 am
by adrian
Hello,

Currently (v16.0) there is no specialized batch Format and Indent operation in Oxygen. We have a feature request already logged for this, I've added your vote.

The XSL processor can be used as a workaround with a copy stylesheet, but note that it removes DOCTYPE declarations and by default it also expands default attribute values. The latter, Expand attribute defaults, can be disabled in the Saxon transformer Advanced options (cogwheel icon) from the transformation scenario.

From what I see, for Saxon-PE/EE you can control a few aspects of indenting/serialization with the help of a few Saxon specific attributes: Saxon > Saxon Extensions > Additional serialization parameters

Code: Select all

<xsl:stylesheet version="2.0" 
e.g. Indent with 4 spaces
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/">
<xsl:output indent="yes" saxon:indent-spaces="4"/>
An alternative workaround would to be enable the option Format and indent the document on open from Options > Preferences > Editor > Format. Then you would have to open all the documents you want formatted from the Project view (maybe in a few smaller batches if there are too many) and save all of them at once(File > Save All). You will probably want to disable the option afterwards since it affects all documents.

Regards,
Adrian