I've created a simple template part that provides a nested repeating structure with outline numbering.
i.e. 1. ...1.1. ...1.1.1. ...1.1.2. ...1.1.3. ...1.2. ...1.2.1. ...1.2.2. ...2.
This is easy to do using xpath by using for the top level ( “numLevel1”) :
count(../preceding-sibling::my:grpLevel1) + 1
and then for the next levels using :
concat(../../my:numLevel1, ".", count(../preceding-sibling::my:grpLevel2) + 1)
concat(../../my:numLevel2, ".", count(../preceding-sibling::my:grpLevel3) + 1)
concat(../../my:numLevel3, ".", count(../preceding-sibling::my:grpLevel4) + 1)
Because it's a template part then it should be reusable without having to re-implement the counting formula – what a great idea...
When it’s previewed in the template part design – it works perfectly.
When it’s deployed in a form template however it doesn’t work.
Looking at the xpath reproduced in the form, the preceding-sibling bit gets collapsed:
count(../preceding-sibling::my:grpLevel1) + 1
becomes
count(..) + 1
What’s going on here ?