[oXygen-user] Pretty Print <lb/> in Oxygen

Alex Jitianu
Tue Jan 12 03:53:32 CST 2016


Dear all,

In Oxygen version 17.1 you have the possibility to specify "Line break" 
elements [1], that is to say elements for which we have to break the 
line before (or after) serializing them. The entries from this new list 
are a form of simplified XPath expressions that also accept one 
attribute condition (default attribute values are not taken into account):/

- element[@attr]/ - Matches all instances of the specified element that 
include the specified attribute./
- element[not(@attr)]/ - Matches all instances of the specified element 
that do not include the specified attribute./
- element[@attr = "value"]/ - Matches all instances of the specified 
element that include the specified attribute with the given value./
- element[@attr != "value"]/ - Matches all instances of the specified 
element that include the specified attribute and its value is different 
than the one given.

We only accept one attribute condition because we want these expressions 
to run as fast as possible but nevertheless, it should suffice for 
writing expression that take into account the @break attribute. Hope it 
helps!

[1] 
https://www.oxygenxml.com/doc/versions/17.1/ug-editor/#topics/preferences-editor-format-xml.html

Best regards,
Alex
-- 
Alex Jitianu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 12/17/2014 7:09 PM, Wendell Piez wrote:
> Syd and Gerrit,
>
> I am so behind! (on old messages to mailing lists) --
>
> In the meantime, until oXygen does everything perfectly, could one
> perhaps introduce the LF characters you want (in your mixed content)
> using XQuery update (which works in oXygen's XQuery Builder), or
> (gasp!) plain-text s/r over the raw XML?
>
> Cheers, Wendell
>
> On Tue, Oct 28, 2014 at 5:06 PM, Syd Bauman <> wrote:
>> I agree with Gerrit; while all Andreas says is true, it is not an
>> argument against having an option for format-and-indent to
>> intelligently insert specific whitespace in front of (or after)
>> desired elements. (Not only are we suggesting this as an option, I
>> suspect all of us on the "I like this feature" side would agree it
>> should be an option that is off by default, for the very reasons
>> Andreas articulates :-)
>>
>> E.g., adding two new tabs to Options > Preferences / Editor / Format
>> / XML / Element Spacing:
>>
>>   1) Starts new line:
>>      Element names or XPath expressions for which the start-tag (or
>>      empty-element tag) should be forced to start on a new line (and
>>      then indented appropriately)
>>
>>   2) Ends line:
>>      Element names or XPath expressions for which the start-tag (or
>>      empty-element tag) should be made the last token on a line
>>
>> Both lists should start out empty, of course.
>>
>> P.S. IIRC, last I checked (years ago) those were not "XPath
>>       expressions", they were not even full XSLT patterns, but rather
>>       were a very limited set of XSLT patterns. If that is still true,
>>       I would strongly recommend changing the wording slightly and
>>       putting some pop-up help or information right there.
>>
>>> I share Ute's wish for a format-and-indent in the text mode that
>>> puts <lb> at the beginning of each line. xml:space does not seem
>>> satisfying to me because it prevents Oxygen from doing any
>>> format-and-indent. Find/replace is neither very elegant nor will it
>>> give the result Syd has described.
>>>
>>> I admit that the addition of whitespace in mixed content elements
>>> where no whitespace exists is generally critical (and I like Oxygen
>>> for not doing this!). However, any whitespace preceding or
>>> following an <lb> can be treated as insignificant. Even
>>>
>>> Oxy<lb break="no">gen
>>>
>>> Oxy
>>> <lb break="no">gen
>>>
>>> are equivalent, except that a little more processing is needed to
>>> extract the token "Oxygen" from such an encoding. So I find it
>>> responsible to allow Oxygen---on explicit request---to add
>>> whitespace befor <lb> elements. At least, it would be nice to get
>>> Oxygen to put all the <lb>s at the beginning of the line that
>>> *already have* whitespace before them.
>> _______________________________________________
>> oXygen-user mailing list
>> 
>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20160112/69622083/attachment.html>


More information about the oXygen-user mailing list