1

Topic: Incomplete copying XML (passes in the output file)

Kind time of days.  did not help, can not on those keywords I search to Google.
As a learning material I use the book "XSLT" Arcs of Tiduell
There is an input file (forms program):

<root>
<element1>
<element2> 2 </element2>
<element3> 3 </element3>
</element1>
</root>

There is a table with two templates:

<xsl:template match = "element2"/>
<xsl:template match = "*">
<xsl:copy>
<xsl:copy-of select = "*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

On an output, naturally, it turns out:

<? xml version = "1.0" encoding = "UTF-8"?> <root>
<element1>
<element3> 3 </element3>
</element1>
</root>

Actually a question: how to eliminate from a file blank lines? I.e. I need to receive:

<? xml version = "1.0" encoding = "UTF-8"?> <root>
<element1>
<element3> 3 </element3>
</element1>
</root>

In the aforementioned book the phrase "is resulted If you want to delete these passes, change the style sheet". But as it to change it is not specified.
<xsl:strip-space/> removes all passes and "molds" all file in single line.
Tried to alter templates then lines "are molded" in one in a parent element (element1)

2

Re: Incomplete copying XML (passes in the output file)

Avers wrote:

Actually a question: how to eliminate from a file blank lines?

Hammer. On structure and the data it is influence does not render, and to look on XML through a notepad is a nonsense

3

Re: Incomplete copying XML (passes in the output file)

_Vasilisk _;
Actually yes, at semantic level presence/absence of blank lines does not change an essence (if they not in elements with the mixed contents). But:
1) so far as concerns a file in the size in ten thousand lines and more than third from them empty is already affects file size;
2) if there is at least a small probability of that XML it is necessary to correct in "field" conditions, expediently to reflect on readership/spaces/imenovanii of tags;
3) and simply it would be desirable to receive a file visually not worse the initial smile
;
<xsl:output indent = "yes"/> without <xsl:strip-space elements = "*"/> does not render influence on the output document, in a combination with <xsl:strip-space elements = "*"/> something turns out like:

<? xml version = "1.0" encoding = "UTF-8"?> <root>
<element1>
<element3> 3 </element3>
</element1>
</root>

Too not absolutely that it would be desirable to receive. Blank lines are not present, but indents miss as those, only line foldings.
Thanks for answers.
It seems that  a way to the decision of my problem - to add after conversion XSLT the second handling, indirect with removal of blank lines.

4

Re: Incomplete copying XML (passes in the output file)

;
Test tables XSLT I do in NetBeans and what there the processor - concept I have no (all works "from a box"). And files I open or all the same NetBeans or in built in in far the editor.
In NetBeans circuits and tables are exceptional written, manually applied. And  the version is built in the application written on C# (there already VS2013/VS2017).
Tried in "xsl:stylesheet" to change property version = "2.0" between 1.0 and 2.0 - a difference did not see.

5

Re: Incomplete copying XML (passes in the output file)

Avers wrote:

1) so far as concerns a file in the size in ten thousand lines and more than third from them empty is already affects file size;

zip

Avers wrote:

2) if there is at least a small probability of that XML it is necessary to correct in "field" conditions, expediently to reflect on readership/indents/imenovanii of tags;

you doc too in a notepad edit files?

Avers wrote:

3) and simply it would be desirable to receive a file visually not worse initial smile

Again 25. The data and data mapping it is in essence different concepts

6

Re: Incomplete copying XML (passes in the output file)

;
Thanks for links, I will mandatory try.
Unfortunately, in my case it does not solve a principal problem. I pack all into bowels of a software, written on C#, even at <xsl:output indent = "yes"/> in a combination with <xsl:strip-space elements = "*"/> gives something like:

<? xml version = "1.0" encoding = "UTF-8" ?><root><element1><element3>3</element3></element1></root>

, what even line foldings are not present. Difference from the previous processor obviously, but, alas, not in that side that is necessary. sad
Similar and truth to process xml as the text ( a way to the purpose) easier.
_Vasilisk _;
[quote = _ Vasilisk _] it is passed...
zip

Possibly, you did not pay attention to my message earlier. This conversion will be in a software, to drag there zip the big sense is not present. Besides experience shows, what even compression zip does not remove a difference in the sizes of files/archives. A file (and also archive with a file) with blank lines (and if to be exact with lines with superfluous gaps and transfer of a line) all the same more than similar without superfluous garbage.
[quote = _ Vasilisk _] it is passed...
You doc too in a notepad edit files?

If it will be necessary, the file is edited also by a notepad and vi and everything that is near at hand. Only doc - , at least docx smile
[quote = _ Vasilisk _] it is passed...
Again 25. The data and data mapping it is in essence different concepts

Possibly you did not note, in the answer above I agreed with you about a difference between display and the content. And also, I ask to pay attention that in a post it is a question of garbage presence (which to show on file display more conveniently and more visually), instead of about a panic in connection with editing xml files in a notepad (as you could think).
As I understand, except the recommendation to "hammer" (it is necessary to tell, not the worst council) on the substance of a problem to add it nothing you.