Chain $ask, $answer and combobox
Posted: Mon Apr 01, 2019 1:25 pm
Hello everybody!
(sorry if the question is already dealt with elsewhere, I was not able to find it)
Working on TEI xml files, I am trying to create a function that will prompt the user to give an input and then use the latter to look up for references in an external file. I am not sure if I am concerned with the bug on xpath_eval and ${answer(@id)} (post51917.html)
In this case, the following operations may be chained? I guess one could use insertFragment (e.g. <bibl xmlns="http://www.tei-c.org/ns/1.0">${caret}</bibl>), then ChangeAttribute (and give an input into @sameAs), then base a query based on this intermediary attribute with another ChangeAttribute operation (e.g.
but I am failing with addressing the current element and deal with the necessary quotes and concatenation of value and labels
Is there a way to use ${answer(@id)} in a single function?
As a comparison, in the associated CSS, it is possible to have
(1) the display of the full reference from the attribute
(2) a combobox with a list of all references to choose from:
With the latter, one get the full list, which I would like to reduce by prompting the user to input a string.
Thanks for any help you can offer!
Dominique
(sorry if the question is already dealt with elsewhere, I was not able to find it)
Working on TEI xml files, I am trying to create a function that will prompt the user to give an input and then use the latter to look up for references in an external file. I am not sure if I am concerned with the bug on xpath_eval and ${answer(@id)} (post51917.html)
In this case, the following operations may be chained? I guess one could use insertFragment (e.g. <bibl xmlns="http://www.tei-c.org/ns/1.0">${caret}</bibl>), then ChangeAttribute (and give an input into @sameAs), then base a query based on this intermediary attribute with another ChangeAttribute operation (e.g.
Code: Select all
${ask(
'Choose reference',
combobox,
(
'${xpath_eval(doc('${cfdu}/biblio.xml')//biblStruct[contains(., current-node()/@sameAs)][1]/@xml:id)}':'${xpath_eval(doc('${cfdu}/biblio.xml')//biblStruct[contains(., current-node()/@sameAs)][1]/@xml:id)}';
'${xpath_eval(doc('${cfdu}/biblio.xml')//biblStruct[contains(., current-node()/@sameAs)][2]/@xml:id)}':'${xpath_eval(doc('${cfdu}/biblio.xml')//biblStruct[contains(., current-node()/@sameAs)][2]/@xml:id)}';
'${xpath_eval(doc('${cfdu}/biblio.xml')//biblStruct[contains(., current-node()/@sameAs)][3]/@xml:id)}':'${xpath_eval(doc('${cfdu}/biblio.xml')//biblStruct[contains(., current-node()/@sameAs)][3]/@xml:id)}'
),
'Three first references')}
Is there a way to use ${answer(@id)} in a single function?
As a comparison, in the associated CSS, it is possible to have
(1) the display of the full reference from the attribute
Code: Select all
bibl[sameAs]{
content:oxy_xpath(
oxy_concat(
"doc('${cfdu}/biblio.xml')//listBibl/biblStruct[@xml:id='", attr(sameAs),"']/normalize-space(string())"
)
);
}
Code: Select all
bibl:after{
content:"Reference"
oxy_popup(edit, '@sameAs',
values,
oxy_xpath(oxy_concat('string-join(doc("', oxy_url('${cfdu}/biblio.xml'), '")//listBibl/biblStruct/@xml:id, ",")')),
selectionMode, single,
labels,
oxy_xpath(oxy_concat('string-join(doc("', oxy_url('${cfdu}/biblio.xml'), '")//listBibl/biblStruct[@xml:id]/replace(normalize-space(*[1]), ",", "|"), ",")'))
)
}
Thanks for any help you can offer!
Dominique