Content control repeat - detect last element
Posted: Thu Jul 27, 2017 10:27 pm
I'm using content controls binding in docx4j to generate word document. I have repeat content control which prints elements in word as text. Each element is separated by ", \r\n".
I'd like to ask if it's possible to make condition with XPath which will check if current iteration is last one, or to check current iteration index. That would allow me to skip seperator for last element.
Example:
XML:
Current output:
I'd like to make output:
I checked XPath position() but it printed -1.
I'd like to ask if it's possible to make condition with XPath which will check if current iteration is last one, or to check current iteration index. That would allow me to skip seperator for last element.
Example:
XML:
- Code: Select all
<elements>
<element>el1</element>
<element>el2</element>
<element>el3</element>
</elements>
Current output:
- Code: Select all
el1,
el2,
el3,
I'd like to make output:
- Code: Select all
el1,
el2,
el3
I checked XPath position() but it printed -1.