I'm having a bit of trouble coming up with the XPath/XSLT expression to express an algorithm.
Table of Contents
first child.................................1
second child................................11
third child.................................16
*The "...." are not really part of the output. They are simply for formatting and clarity
The purpose of the algorithm is to find out what page the 'CDATA' section of each 'child-node' would start on,
assuming that each CDATA section would begin on a new page. This can be expressed as the following algorithm (in psuedo code):
- When the current 'child-node' is being processed
- For every 'child-node' before the current 'child-node' get the value of the 'number-of-pages' attribute
- Sum the values then add 1
- The value of the previous step is the page number that the 'CDATA' section of the current 'child-node' will start on ...
... Therefore if there were a forth-child element it would print,
fourth child............................. 36 (because 20 + 5 + 10 + 1 = 36)
The XSLT/XPath construct that I currently have looks like this (pretend the spacing, carriage returns, and tabs are being magically handled):
Table of Contents
..............
I've tried all sorts of different expressions at POC. The one you see now is just the latest. Any help would be greatly appreciated.