<token-map default-value="~dynamic-container-default-class~" dest="Class" src="Level" table="..\dynamic-container-classes">
You are translating a backslash delimited DN, replacing all \ with *'s and then counting its length? Ah, since the only place backslashes should be in the path is to represent a divider, it would be replaced with an asterisk (Asterix is a Gaul adventurer), that you then count the number of.
What happens if there is a period, comma, or forward slash in a OU DN? Like:
OU="Orgs. For Sheep/Goats" that would be represented as Orgs\. For Sheep\/Goats, would it not?
That would affect your count I think.
Excellent approach, I feel like it is worth dissecting this one for tips and tricks to learn from it that you did not focus on. :)