Syntax with string-join in CSS (child elements, normalize-space)

<oXygen/> general issues.
stutzmann
Posts: 5
Joined: Fri Mar 29, 2019 12:25 am

Syntax with string-join in CSS (child elements, normalize-space)

Post by stutzmann » Sat Apr 06, 2019 8:56 pm

Hi everyone!

(this topic is stemming from: post53287.html)

Thanks to Sorin's indication, I was able to transfer one condition in oxy_xpath with quotes and apostrophes in string-join (inverting both quotes and apostrophes), either to display some content

Code: Select all


bibl[sameAs]{
content:oxy_xpath(
oxy_concat(
"doc('${cfdu}/biblio.xml')//listBibl/biblStruct[contains(@xml:id, '", attr(sameAs),"')]/normalize-space(string())"
)
);
}
or to have a combobox (the following one with a quite non-sensical condition (all references with the same date in the 20th century, based on date as string)

Code: Select all


bibl[sameAs]:after{
content: "Reference-id"
oxy_combobox(edit, '@sameAs',
values,
oxy_xpath(
oxy_concat(
'string-join(doc("', oxy_url('${cfdu}/biblio.xml'), '")//listBibl/biblStruct[contains(@xml:id, substring-after("',attr(sameAs),'", "19"))]/@xml:id, ",")'
)),
editable, true,
labels,
oxy_xpath(
oxy_concat(
'string-join(doc("', oxy_url('${cfdu}/biblio.xml'), '")//listBibl/biblStruct[contains(@xml:id, substring-after("',attr(sameAs),'", "19"))]/@xml:id, ",")'
))
)
}
However, I apparently cannot display sub-elements as labels nor work with functions such as concat() or normalize-space().
When, again, the following is working to display a string

Code: Select all


bibl[sameAs]{
content:oxy_xpath(
oxy_concat(
'string-join(doc("', oxy_url('${cfdu}/biblio.xml'), '")//listBibl/biblStruct[contains(attribute::xml:id, normalize-space("',attr(sameAs),'"))]/normalize-space(string()), ",")'
)
);
}
[\code]

I have tried with the following, with subelements that are present, always, once and only once.
[code]
bibl[sameAs]:after{
content: "Reference"
oxy_combobox(edit, '@sameAs',
values,
oxy_xpath(
oxy_concat(
'string-join(doc("', oxy_url('${cfdu}/biblio.xml'), '")//listBibl/biblStruct[contains(attribute::xml:id, "',attr(sameAs),'")]/@xml:id, ",")'
)),
editable, true,
labels,
oxy_xpath(
oxy_concat(
'string-join(doc("', oxy_url('${cfdu}/biblio.xml'), '")//listBibl/biblStruct[contains(attribute::xml:id, "',attr(sameAs),'")]/monogr/title/normalize-space(string()), ",")'
))
)
}
Is there an error in the code or syntax?

Thanks for any explanation,
Dominique

sorin_carbunaru
Site Admin
Posts: 248
Joined: Mon May 09, 2016 9:37 am

Re: Syntax with string-join in CSS (child elements, normalize-space)

Post by sorin_carbunaru » Mon Apr 08, 2019 5:16 pm

Hello Dominique,

This is because your combo box is editable. For editable combo boxes we decided that we render the actual values. Let me tell you why... Let's say you could have 2 values in the CSS in the beginning, each having a label. Because the combo box is editable, the user could add a new one, the third. But they would provide the actual value to be added in the model, right?... So, how would they provide the label from the Author page?... See? Working with model values and rendered labels with editable combo boxes would be quite tricky...

You will see that if you made your combo box non-editable, the labels would be rendered.

By the way, I just wanted to also point out that, when needed, you could create your own form controls (see https://www.oxygenxml.com/doc/versions/ ... trols.html).

Best wishes,
Sorin Carbunaru
oXygen XML

fillipppyatochckin
Posts: 1
Joined: Wed Apr 03, 2019 5:35 am

View first unread post

Post by fillipppyatochckin » Fri Apr 12, 2019 2:07 am

Hi,

How active are the moderators on here? My first post is awaiting approval.

It contained a link to a .SVG to help illustrate my question. This is hosted on my own website. Would that cause my post to go straight in the trash before even reaching a mod?

Thanks

Andrew

stutzmann
Posts: 5
Joined: Fri Mar 29, 2019 12:25 am

Re: Syntax with string-join in CSS (child elements, normalize-space)

Post by stutzmann » Fri Apr 12, 2019 10:33 am

Dear Sorin,
this is absolutely clear. Thank you for your help, again and very very much.
Dominique

Post Reply