"Soft" indenting on a per-element basis

Are you missing a feature? Request its implementation here.
dsewell
Posts: 125
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

"Soft" indenting on a per-element basis

Post by dsewell »

It would be useful to have an option to indent certain elements in the editor view without inserting an actual linebreak + indentation in the underlying XML. This need arises most often with mixed-content XML, for example using TEI markup. Consider the typical case of marking text that reads "I saw m**y men there", where one editor gives "many" and another editor gives "merry". In TEI you could code this:

Code: Select all

I saw m<app><rdg wit="E1">an</rdg><rdg wit="E2">err</rdg></app>y men there
This would be much easier to read and edit in this format:

Code: Select all

I saw m
<app>
<rdg wit="E1">an</rdg>
<rdg wit="E2">err</rdg>
</app>
y men there
However, adding actual whitespace to the XML would create a false break between the letters of the word many/merry.

If there was a toggle option to add a "soft" indent before <app> and <rdg>, it would make editing easier while preserving correct content.

I know that some XML editors that use style sheets (like epcEdit) make this possible.
george
Site Admin
Posts: 2097
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi David,

That is very hard to implement in oXygen, currently on format and indent it gives (with hard line breaks):

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<test>I saw m<app>
<rdg wit="E1">an</rdg>
<rdg wit="E2">err</rdg>
</app>y men there</test>
Now the stylesheet that process this document should know that app has an element only content and should disregard the line breaks. If it does not then you can eventually try creating a stylesheet like:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="app"/>
<xsl:include href="yourStylesheet.xsl"/>
</xsl:stylesheet>
where yourStylesheet.xsl is the actual stylesheet you are using now and use this new stylesheet in the transformation scenario.

Best Regards,
George
dsewell
Posts: 125
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Thanks

Post by dsewell »

This looks like a good work-around.

David
Post Reply