Comma in oxy_editor combobox

Post here questions and problems related to oXygen frameworks/document types.
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Comma in oxy_editor combobox

Post by Johann »

Hello,

I can't solve a problem with an oxy_editor combobox.

From this XML example:

Code: Select all

<items>
               <item>
                  <title1>item1</title1>
               </item>
               <item>
                  <title2>item2</title2>
               </item>
               <item>
                  <title1>item3</title1>
               </item>
</items>

I created an oxy_editor combobox so that the user can choose his item.
As you can see there are two types of titles (title1 / title2).

This is the first version of the CSS code:

Code: Select all

content: oxy_editor(type, combo, edit, "@attr", editable, false, values, oxy_xpath('string-join(//item/title1 | //item/title2 , ",")'));

It works.

Now, this is the XML to be processed:

Code: Select all

<items>
               <item>
                  <title1>item1</title1>
               </item>
               <item>
                  <title2>ite,m2</title2>
               </item>
               <item>
                  <title1>item3</title1>
               </item>
</items>
The comma in the second title is a problem so I wrote something like that to handle it:

Code: Select all

  content: oxy_editor(type, combo, edit, "@attr", editable, false, values, oxy_xpath('replace(replace(string-join(//item/title1 | //item/title2 , "!!"), ",", ";"), "!!", ",")'));
The comma is replaced by a semicolon in the combobox which is a workaround but not a solution.

So my question, do you have a suggestion in order to display a comma instead of the semicolon?
How to escape the comma character inside the oxy_xpath?

Thank you,

Johann
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Comma in oxy_editor combobox

Post by mihaela »

Hello,

There is a note in the "Combo Box Form Control" documentation that says:
Typically, when you use a comma in the values of a form control, the content that follows a comma is considered a new value. If you want to include a comma in the values, precede the comma with two backslashes.
So, what you have to do is to replace "," with "\\\\," instead of ";".

Best regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Re: Comma in oxy_editor combobox

Post by Johann »

Hello,

Ok, my bad on this.

I tried "\\," but it did not do the job.

4 backslashes were needed on the CSS side :oops:

Thank you,

Johann
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Comma in oxy_editor combobox

Post by mihaela »

Hi,

We are glad that you fixed the problem. Please let us know if you encounter any other problems.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply