Indentation, and diffing

Hi, I've just installed the brand-new 11.1. Congrats! Just a couple of questions/remarks. The announce says "Visual Editing of the XSLT Documentation". How can I use it? I sometimes, in quite specific cases, do align attributes and namespace declarations of an element each on its own line, the first one after the element name then other at the same position as the first one: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:http="http://www.expath.org/mod/http-client" xmlns:ser="http://www.fgeorges.org/xslt/serial" exclude-result-prefixes="#all" version="2.0"> I've never used Cmd-P on stylesheets, but with the new documentation system, I do, as my stylesheets do contain text elements now. And those attributes are realigned like this: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:http="http://www.expath.org/mod/http-client" xmlns:ser="http://www.fgeorges.org/xslt/serial" exclude-result-prefixes="#all" version="2.0"> Is it possible to tell oXygen to not indent attributes aligned on their element's name? Another strange behaviour is reformatting the following: <xsl:sequence select=" if ( exists($relative) ) then resolve-uri($relative, $base) else $base"/> as: <xsl:sequence select=" if ( exists($relative) ) then resolve-uri($relative, $base) else $base "/> And if I copy and paste the former, I get the following: <xsl:sequence select=" if ( exists($relative) ) then resolve-uri($relative, $base) else $base"/> Lines are re-indented (with 3 spaces instead of 4) and all on the same column. This is quite perturbing to have the usual paste to format the pasted content. And last but not least, I often align attributes of different elements, on subsecutive lignes, on the same columns: <xsl:variable name="one" select="..."/> <xsl:variable name="thirteen" select="..."/> <xsl:variable name="two" select="..."/> But after Cmd-P, all attributes are separated by one single space (when they stay on the same line). Is there a way to disable changing the spaces between attributes? Oh yes... And I like the standalone diff application! When diffing two XML files, is it possible to save a third file, with diffs annotated? To get something like the XMLSpec diff version? I know diffing XML is a hard problem, because of the numerous ways of defining what's a difference, what's an addition, what's a modification, etc. But that would be very helpful as a first draft, even if we had to fine-tune the file by hand in a second time. Well, sorry for all those little, various notes in a single email.. Hope that helps! Regards, -- Florent Georges http://www..fgeorges.org/

Hi Florent, You will be able to edit the XSLT documentation visually if you switch to the Author page. Please note that the XSLT will be serialized after editing, that is it will be formated by oXygen. There are a number of options that we offer for the format and indent action. They are available from Options->Preferences -- Editor / Format / XML. You can try the "Break line before attribute's name" to get something like <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:http="http://www.expath.org/mod/http-client" xmlns:ser="http://www.fgeorges.org/xslt/serial" exclude-result-prefixes="#all" version="2.0"> A possible enhancement will be to add an additional option, something like: [x] Starting with the second attribute that when enabled will cause the first attribute to stay on the same line with the element name and to align the rest of the attributes with the first one, like in your sample. I cannot reproduce the 3 spaces indent issue. Please note that by default oXygen is set to detect automatically the indent from the file content. Just make sure the detected indent is not 3, or disable the "Detect indent on open" option from Options->Preferences -- Editor / Format. To disable indenting on paste go to Options->Preferences -- Editor / Format / XML and disable the "Indent on paste" option. There is no option to preserve the space between attributes. You may find useful the "Format and indent element" action, CMD+I on Mac, that indents the current element. Also, if you have a selection the "Indent selection" action (that can be triggered also with CMD+I on Mac) will act only on the indents, without changing anything in other places. The diff and merge support is still available in oXygen XML editor but it is also a separate product. Right now it does not offer a result file. However I expect that having it as a separate product will result in allocating more development resources in that direction so we will consider improving it, including such a result file and 3-way diff and merge support for XML files. Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Florent Georges wrote:
Hi,
I've just installed the brand-new 11.1. Congrats! Just a couple of questions/remarks. The announce says "Visual Editing of the XSLT Documentation". How can I use it?
I sometimes, in quite specific cases, do align attributes and namespace declarations of an element each on its own line, the first one after the element name then other at the same position as the first one:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:http="http://www.expath.org/mod/http-client" xmlns:ser="http://www.fgeorges.org/xslt/serial" exclude-result-prefixes="#all" version="2.0">
I've never used Cmd-P on stylesheets, but with the new documentation system, I do, as my stylesheets do contain text elements now. And those attributes are realigned like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:http="http://www.expath.org/mod/http-client" xmlns:ser="http://www.fgeorges.org/xslt/serial" exclude-result-prefixes="#all" version="2.0">
Is it possible to tell oXygen to not indent attributes aligned on their element's name?
Another strange behaviour is reformatting the following:
<xsl:sequence select=" if ( exists($relative) ) then resolve-uri($relative, $base) else $base"/>
as:
<xsl:sequence select=" if ( exists($relative) ) then resolve-uri($relative, $base) else $base "/>
And if I copy and paste the former, I get the following:
<xsl:sequence select=" if ( exists($relative) ) then resolve-uri($relative, $base) else $base"/>
Lines are re-indented (with 3 spaces instead of 4) and all on the same column. This is quite perturbing to have the usual paste to format the pasted content.
And last but not least, I often align attributes of different elements, on subsecutive lignes, on the same columns:
<xsl:variable name="one" select="..."/> <xsl:variable name="thirteen" select="..."/> <xsl:variable name="two" select="..."/>
But after Cmd-P, all attributes are separated by one single space (when they stay on the same line). Is there a way to disable changing the spaces between attributes?
Oh yes... And I like the standalone diff application! When diffing two XML files, is it possible to save a third file, with diffs annotated? To get something like the XMLSpec diff version? I know diffing XML is a hard problem, because of the numerous ways of defining what's a difference, what's an addition, what's a modification, etc. But that would be very helpful as a first draft, even if we had to fine-tune the file by hand in a second time.
Well, sorry for all those little, various notes in a single email.. Hope that helps!
Regards,

George Cristian Bina wrote: George, Thank you for those detailed infos. I will look at the doc and try to convince my fingers to integrate those behavioral changes ;-)
I cannot reproduce the 3 spaces indent issue.
Well, I was maybe not clear. I indent elements by 3, but long XPath expressions in XSLT (they are attribute values) are spanned over multiple lines, indented by 4 (from the element opening '<' column), then inner-XPath indentation is 2 spaces. Ok, I know, that can sound weird :-) I was just surprised a simple paste was changing that, but....
To disable indenting on paste go to Options->Preferences -- Editor / Format / XML and disable the "Indent on paste" option.
...excellent!
There is no option to preserve the space between attributes..
Mmh... I do align attributes quite often. Especially in XML Schema (and XSLT). And for what I see around me, it seems to be quite usual (at least in XML Schema). Maybe worth adding it?
CMD+I
I think I'm gonna love that one! I am always a bit worry when using Cmd-P, as this is a command acting on the whole file, where most of the time Cmd-i seems to be exactly what I want. Thanks!
so we will consider improving it, including such a result file and 3-way diff and merge support for XML files.
Great! Thanks again for your help, regards, -- Florent Georges http://www.fgeorges.org/
participants (2)
-
Florent Georges
-
George Cristian Bina