Is this expected behaviour?

Using XPP 9.4 in CSS mode if I have:

para::before { counter-reset: tester 5; content: counter(tester); }

then I get the 5 output before the start of the text, however if I have:

para::after { counter-reset: tester 5; content: counter(tester); }

then the output is zero.

I don't understand why I can't load a value into a counter in the "after" selector - am I missing something?

Parents
  • Chris (and Bart), as far as I can tell XPP composition is not processing any counter-reset or counter-increment properties at all that occur within an ::after pseudo element.

    Entering your ticket with Customer Support was the right action.

    It does seem a bit "unusual" to want to use counter-reset and/or counter-increment in an ::after pseudo element.

    I imagine it's an oversight (i.e. there was no known "use case" at the time of implementation), but I'm not all that familiar with CSS and specifically in the context of XPP composition, so we'll need to make sure that there's not any reason that it would cause a "problem" to add it (i.e. "fix the apparent bug").

    Jonathan Dagresta
    SDL XPP Engineering

Reply
  • Chris (and Bart), as far as I can tell XPP composition is not processing any counter-reset or counter-increment properties at all that occur within an ::after pseudo element.

    Entering your ticket with Customer Support was the right action.

    It does seem a bit "unusual" to want to use counter-reset and/or counter-increment in an ::after pseudo element.

    I imagine it's an oversight (i.e. there was no known "use case" at the time of implementation), but I'm not all that familiar with CSS and specifically in the context of XPP composition, so we'll need to make sure that there's not any reason that it would cause a "problem" to add it (i.e. "fix the apparent bug").

    Jonathan Dagresta
    SDL XPP Engineering

Children
  • Well I have been thinking a bit more on this problem and maybe because in this case we are working 'after' the element, the system is addressing a different level of the counter.
    After all for mulit-level numbered list we use the same named counter, but the system keeps track of the level in which we use this 'named counter' and outputs (or resets) the correct value for a particular level of the named counter. All of this without us as users having to care about which level we are in.

    It is unclear to me when the system decides to use multi level named counters or just a single level counter.
    (could be tricky if you want to use the same unique counter at different levels in your document...?) 

    It would be nice if engineering can give us some more info on this

  • As far as the additional info goes, well it seems to be there (although not in the CSS/counter section with examples). Additional info can be found in the xymacro manual on page 4-92:Screenshot of Trados Studio manual page showing 'Set Named Counter Number Register' section with format, arguments, and comments.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 5:17 AM (GMT 0) on 5 Mar 2024]
  • The use of counters is really a CSS thing, not specifically an XPP thing.

    We really try to avoid extensively documenting CSS things in the XPP CSS documentation (other than how to "specify" them with XPP, or any limitations that might apply with XPP), that can be otherwise found (and belong) elsewhere.

    As far as counters and "levels", hopefully we've implemented it in XPP so that they just work the way that they are supposed to for CSS.

    That being said, I could see us making a few minor tweaks to the specified Syntax and identifier integer Value/Description rows for counter-increment and counter-reset in the CSS manual to explain how to specify multiple counters (it's already implied by saying "one or more counters" that you can specify multiple counters).

    Jonathan Dagresta
    SDL XPP Engineering

  • maybe because in this case we are working 'after' the element, the system is addressing a different level of the counter

    No, that's not the reason that the counter-reset (and counter-increment) in an ::after element are not working.

    The system could interpret that 'before' and 'after' elements were a different level of the counter, but that does not seem reasonable and certainly is not helpful/useful. XPP already interprets that counter-reset/counter-increment in a 'before' element are at the same level as the base level.

    As I said, I found that the XPP composition code currently is not doing anything for counter-reset/counter-increment that occur in an 'after' element; they are simply being ignored.

    As we investigate, for now we're treating that as a defect. I don't believe it was done consciously, but was an oversight (and we didn't realize because we had no use cases, or samples, that were using these properties in an 'after' element). I did find (at w3.org CSS2 Counters) that counter-reset/counter-increment (should) apply to all elements (which would include the 'after' element type).

    But we have to put any proposed fix through it's paces to make sure we get it right and don't cause any other problems.

    Jonathan Dagresta
    SDL XPP Engineering