[Fixed] Ninja technique automating node IDs
This is an open discussion with 1 reply, filed under XSLT.
Search
And the question has been answered!
For posterity if anyone else needs it, the solution was:
count(preceding-sibling::*[name()=name(current())]) + 1
Create an account or sign in to comment.
Despite using Symphony for a while, I haven’t really had a need to do anything with the ninja technique until now. So I’m trying to take an HTML formatted entry:
and append IDs to each element in the output like so:
I feel like what I want to do should be obvious, but I can’t seem to get it right. No matter what I do, it just numbers things sequentially, here is the closest I’ve been able to get:
It just counts every preceding node no matter what I put after
preceding-sibling::
What am I doing wrong? Am I going down the wrong path?