Ordered list initial number
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 8
- Joined: Mon Sep 12, 2022 8:22 am
Ordered list initial number
Hello
I am trying to get ordered lists to start from value, defined by attribute
Css, that theoretically should work
If I replace oxy_add part with number it works (so selectors are correct)
oxy_xpath part is correct too - tested by adding :before rule with it as content
Using
doesn't work a well
Generated editor html -
for
Thank you
I am trying to get ordered lists to start from value, defined by attribute
Css, that theoretically should work
Code: Select all
counter-reset: item-count oxy_add(oxy_xpath('../@start'), '-1', number);
oxy_xpath part is correct too - tested by adding :before rule with it as content
Using
Code: Select all
counter-reset: item-count oxy_xpath('../@start');
Generated editor html -

for
Code: Select all
<ol id="ol_ew2_345_wwb" start="5">
<li>asdfsdfg</li>
<li>dfghfgdhj</li>
</ol>
-
- Site Admin
- Posts: 170
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Ordered list initial number
Post by Bogdan Dumitru »
Hello,
The problem that you encountered is caused by the fact that Oxygen XML Web Author lets the browser evaluate "counter-reset" and "counter-increment" CSS properties but the browser fails to evaluate "oxy_xpath" which is Oxygen-specific.
So you cannot use "oxy_xpath" as a value to the "counter-reset" CSS property in Oxygen XML Web Author.
As a solution, we think that you might be able to define CSS selectors for each value of the "start" attribute, somewhat like this:
or maybe you can try using "attr" CSS function if possible, maybe like this:
The problem that you encountered is caused by the fact that Oxygen XML Web Author lets the browser evaluate "counter-reset" and "counter-increment" CSS properties but the browser fails to evaluate "oxy_xpath" which is Oxygen-specific.
So you cannot use "oxy_xpath" as a value to the "counter-reset" CSS property in Oxygen XML Web Author.
As a solution, we think that you might be able to define CSS selectors for each value of the "start" attribute, somewhat like this:
Code: Select all
ol[start="1"] {
counter-reset: item-count 1;
}
ol[start="2"] {
counter-reset: item-count 2;
}
...
Code: Select all
ol[start] {
counter-reset: item-count attr(start);
}
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 8
- Joined: Mon Sep 12, 2022 8:22 am
Re: Ordered list initial number
Thank you for your answer
Unfortunatelly attr doesn't work with counter-reset
But since data-attr-start is generated by Oxygen, it gave me another idea
is called in my plugin and sets OL numbering correctly
Problem left is that change is lost on document change. Currently calling it in setInterval which is not a long-term approach.
Question - how to subscribe to document change (or html redraw) event? Should be obvious but cannot find it in help or forum .
Thank you
Unfortunatelly attr doesn't work with counter-reset
But since data-attr-start is generated by Oxygen, it gave me another idea
Code: Select all
document.querySelectorAll('ol[data-attr-start]').forEach(n => n.style.counterReset = 'item-count ' + (n.getAttribute('data-attr-start') - 1));
Problem left is that change is lost on document change. Currently calling it in setInterval which is not a long-term approach.
Question - how to subscribe to document change (or html redraw) event? Should be obvious but cannot find it in help or forum .
Thank you
-
- Site Admin
- Posts: 170
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Ordered list initial number
Post by Bogdan Dumitru »
Hi,
We strongly suggest not building any customization that relies on the HTML DOM it's not an API of the application, thus you might generate subtle bugs and it might not work in a future version of Oxygen XML Web Author. See the Oxygen SDK for the Java API and the Customizing Web Author Using JavaScript Code for the JS API.
So the only solution for you is to generate a CSS with many matches for most of the "start" attribute values, like this:
We strongly suggest not building any customization that relies on the HTML DOM it's not an API of the application, thus you might generate subtle bugs and it might not work in a future version of Oxygen XML Web Author. See the Oxygen SDK for the Java API and the Customizing Web Author Using JavaScript Code for the JS API.
So the only solution for you is to generate a CSS with many matches for most of the "start" attribute values, like this:
Code: Select all
ol[start="1"] {
counter-reset: item-count 1;
}
ol[start="2"] {
counter-reset: item-count 2;
}
ol[start="3"] {
counter-reset: item-count 3;
}
...
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service