spaces are getting trimmed from content

Having trouble installing Oxygen? Got a bug to report? Post it all here.
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

spaces are getting trimmed from content

Post by SmitaPatil »

Hi Team,
when I am inserting fragment using insertXMLFragmentSchemaAware method, space present in text content is getting trimmed.
Can you please tell if there is any to avoid it while using this method or any other method which will work better to insert string fragment in document.

Thanks & Regards,
Smita
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: spaces are getting trimmed from content

Post by Bogdan Dumitru »

Hi Smita,

Your spaces are inside the elements within your fragment, or around them? Could you please share the fragment?
If the spaces are inside an element, the element has the "white-space: pre" CSS property specified? Note that spaces are preserved only if the "white-space" property says so.
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: spaces are getting trimmed from content

Post by Bogdan Dumitru »

Hi again,

Do you encounter this problem if you insert the fragment manually in the text page (Edit as XML) and then switch to author mode? If after the switch you don't see whitespaces preserved inside the element, then check that you have the "white-space: pre" specified in the framework's CSS files.
Bogdan Dumitru
http://www.oxygenxml.com
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: spaces are getting trimmed from content

Post by SmitaPatil »

Hi Bogdan,
I have tried by doing edit xml and adding following xml fragment

Code: Select all

<tgroup cols="3">
	<colspec colname="col1"/>
	<colspec colname="col2"/>
	<colspec colname="col3"/>
	<tbody>
		<row>
			<entry>
				<para>
					<paratext>check                   for                     space </paratext>
				</para>
			</entry>
			<entry/>
			<entry/>
		</row>
		<row>
			<entry/>
			<entry/>
			<entry/>
		</row>
	</tbody>
</tgroup>
but in author mode it is showing as below only one one white space and others are getting trimmed :
image.png
image.png (24.23 KiB) Viewed 799 times
and for that css property for text inside entry is as below:
image.png
image.png (6.63 KiB) Viewed 799 times
We don't want to loose any space from content while inserting fragment.
Please let me know if you need any other information.

Thanks & Regards,
Smita
Last edited by SmitaPatil on Fri Dec 23, 2022 12:17 pm, edited 1 time in total.
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: spaces are getting trimmed from content

Post by mihaela »

Hi,

It seems that there are some missing images in your message. Can you please add them so that we better understand your use case?

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: spaces are getting trimmed from content

Post by SmitaPatil »

Hi Mihaela,
Sorry I haven't seen it properly.
I have updated image in last post.

Thanks & Regards,
Smita
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: spaces are getting trimmed from content

Post by cristi_talau »

You need to add the "white-space: pre" property in the CSS of your framework. The rule should be:

Code: Select all

paratext {
  white-space: pre;
}
The rule that you see in the browser applied to the rendering of the XML text node that is a child of the "paratext" element.
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: spaces are getting trimmed from content

Post by SmitaPatil »

Hi,
Thank you!
It helped to resolved the issue.

Thanks,
Smita
Post Reply