Page 1 of 1

CSS (oxy_)xpath: use of current()

Posted: Wed May 09, 2018 12:29 pm
by StefanKlatt
Dear “colleagues”
At our university we are developing a medical dialect.
In the past we were using relatively complex CSS-Statements (for authoring) that made use of current().
This worked fine in another editor, that supported current() from XSLT/Xpath also in CSS.
Here is an example (automatic pseudo-numbering of comment paragraphes)

content: xpath("count(//ns:Comment[count(following-sibling::ns:Comment[attribute::Id = current()/@Id])> 0])+1")

Does anyone see a way to realize this with oxy_xpath? The matter is "current()"
Stefan

Re: CSS (oxy_)xpath: use of current()

Posted: Wed May 09, 2018 1:38 pm
by Radu
Hello Stefan,

We do not have an equivalent of the current() XSLT function in XPath but we do have the possibility to create the xpath by merging together multiple values.
Something like this:

post41199.html#p41193

meaning in your case something like:

Code: Select all

oxy_xpath(oxy_concat("count(//ns:Comment[count(following-sibling::ns:Comment[attribute::Id = '", attr(Id),"])> 0])+1"))
Regards,
Radu

Re: CSS (oxy_)xpath: use of current()

Posted: Thu May 10, 2018 2:00 pm
by StefanKlatt
Hey Radu,

thanks for this solution - f.e. it works fine with

content: oxy_xpath(oxy_concat("//sources:entry[attribute::id='",attr(idRef),"']/child::*/string()"))

for the visualisation of @id / @idRef pairings in author mode.

Regards

Stefan