Page 1 of 1
XML/XSLT Indent options - more tags in one line.
Posted: Mon Jan 22, 2007 4:27 pm
by ripos
I'm writing XSLT transformations to the XML of the specified structure,
so most of the code looks like this:
Code: Select all
<LineOne>
<xsl:value-of select="$bill-to/ADDRESS1"/>
</LineOne>
<LineTwo>
<xsl:value-of select="$bill-to/ADDRESS2"/>
</LineTwo>
This is after autoformatting of the code.
I'm not sure, but looks like it is not possible to tell oXygen to preserve line non-breaks if possible.
I'm writing strings, that are far from the line width, but still they are reformatted.
The code became much longer and much less readable.
I want to preserve next string after autoformat:
Code: Select all
<LineOne><xsl:value-of select="$bill-to/ADDRESS1"/></LineOne>
<LineTwo><xsl:value-of select="$bill-to/ADDRESS2"/></LineTwo>
What should I set in the options?.. or if it is not possible when there will be release where can I see this?
Posted: Mon Jan 22, 2007 6:05 pm
by sorin_ristache
Hello,
If LineOne and LineTwo do not contain text child elements then oXygen assumes they have element only content model so it places each child element on a new line indented with the size defined in Preferences -> Editor -> Format -> Indent size. The result is considered generally more readable than placing the child elements on the same line with the parent, in your case LineOne or LineTwo. If you want to preserve child elements on the same line with the parent you have to add the element names of LineOne and LineTwo in the Preserve space elements list available in Preferences -> Editor -> Format -> XML.
Regards,
Sorin
Posted: Mon Jan 22, 2007 6:17 pm
by ripos
Thanks for such quick and good reply.
But I did not find these options:
I go to Options/Editor/Format/XML.
Here are the options:
[ ] Format and indent document on the open
[ ] Expand empty elements
[ ] Add space before slash in empty elements
[ ] Sort attributes
[x] Preserve empty lines
[x] Preserve text as it is
[ ] Preserve line breaks in attributes
[x] Break ling attributes
[ ] Break line before attribute's name
I'm using oXygen 8.0 build 2006112715
Posted: Mon Jan 22, 2007 6:32 pm
by sorin_ristache
The Preserve space elements list is located under
[ ] Break line before attribute's name
To edit the list use the Add and Remove buttons located inside the panel with the title "Preserve space elements (XPath)". Press F1 to read in the User Manual about using these options.
The Indent size option is available in Preferences -> Editor -> Format.
Regards,
Sorin
Posted: Tue Jan 23, 2007 1:12 pm
by ripos
Sorry for the inconvinience, but I still do not understand.
I should exlude from cutting the spaces in all tags, that have only only tag xsl:value-of inside.
I have tried to add into the preserve list:
But it does not help.
Could you please help me with the correct XPath that I should insert?
[/code]
Posted: Tue Jan 23, 2007 1:14 pm
by ripos
Posted: Tue Jan 23, 2007 2:28 pm
by sorin_ristache
This form of XPath expression is not supported in the Preserve space elements list. Press F1 when the Editor / Format / XML preferences page is displayed to read about the supported forms:
- author
- //listing
- /chapter/abstract/title
- //xs:documentation
You have to add the name of the parent element of xsl:value-of in the list, that is LineOne, LineTwo.
Regards,
Sorin
Posted: Tue Jan 23, 2007 2:43 pm
by ripos
Thanks a lot for the reply!
This does not solve my problem at all.
So this thread is a true feature request.
I want to more tweaks to autoformatting mechanism.
For example I want to apply next rules:
1) if tag opening and ending are on the same line, then do not reformat them.
2) If the tag is longer then one line, then there could not be any other tags on these lines (except comments)
I do not request to make it fast. Just as a suggestion for the improvment.
You may also look for the IntelliJ IDEA development IDE. They have pretty much autoformatting tweaks. =) And good system of their managment.
Posted: Fri Jan 26, 2007 5:09 pm
by sorin_ristache
ripos wrote:I want to more tweaks to autoformatting mechanism.
For example I want to apply next rules:
1) if tag opening and ending are on the same line, then do not reformat them.
2) If the tag is longer then one line, then there could not be any other tags on these lines (except comments)
We will analyze these formatting options.
Thank you,
Sorin