Custom XML formatting?

Something has been bothering me for quite some time.

I can confidently say 

XProc is powerful
XSLT 2 is powerful
XPath 2 is *unbelievably* powerful (and can be used independent of the previous languages)

…

However…is it just me, or um—is it really, *really* weird just how little control I have over the formatting of XML created using XProc/XSLT?

(And by “formatting”, I mean “coding style”.  If you’ve ever joined a project with a document titled something like “Coding Style Guidelines”, that’s what I’m talking about.)

…

I mean, sure—there’s @indent = “yes | no”.  

And @xml:space, strip-space, and preserve-space.  But hasn’t anyone ever put a lot of time into really, REALLY using these everywhere possible, and then looked at the generated XML and thought “God, that’s just hideous!” ?  I mean, it’s not uncommon for me to find that generated markup is irritating as hell to read.  

…

I constantly find myself arriving at the following questions:
 
What if I want to specify certain elements have 1 attribute per line each?  
What if I want to apply that to certain elements but not others?  
What if I want to apply it to an element only SOMETIMES—depending on arbitrary conditions?

…

I see these amazingly powerful tools, and I see that they recognize whitespace is significant.  But it’s significant beyond CDATA and snippets of code.  There is real value in producing XML that is *easy for human eyes to read*.  

(And if that weren’t true, then obviously programmers would never, ever argue about coding style…or have a reason to publish documents titled “Code Style Guidelines”.  Am I right? ☺)

…

So, is this ever a problem for anybody else?  

Is there a solution to this I haven’t heard about yet?  

Any current ongoing work on this issue?

…

Thanks one and all,

—Tony

Received on Saturday, 18 December 2010 23:47:30 UTC