Mike Partridge
Usenet Archive
- Joined
- Jan 13, 2004
- Messages
- 6
- Reaction score
- 0
Is it possible to access your caller's (not parent) context while inside a <xsl:template match...> or <xsl:for-each...>? Here is the xml I'm using:
<report-set>
...<report>
.....<detail-data>
.......<detail-column position="1" dsc="col1" sum_fg="0"/> .......<detail-column position="2" dsc="col2" sum_fg="1"/> .......<detail-column position="3" dsc="col3" sum_fg="1"/> .......<detail-column position="4" dsc="col4" sum_fg="1"/> .......<detail-column position="5" dsc="col5" sum_fg="1"/> .....</detail-data> .....<invoice inv_id="232243"> .......<break level="1"> .........<break level="2"> ...........<break level="3"> .............<detail> ...............<row> .................<field position="1">Text1</field> .................<field position="2">34</field> .................<field position="3">3400.00</field> .................<field position="4">0.00</field> .................<field position="5">3400.00</field> ...............</row> ...............<row> .................<field position="1">Text2</field> .................<field position="2">96</field> .................<field position="3">9600</field> .................<field position="4">0.00</field> .................<field position="5">9600.00</field> ...............</row> .............</detail> ...........</break> ...........<break level="3"> .............<detail> ...............<row> .................<field position="1">Text1</field> .................<field position="2">13</field> .................<field position="3">1300.00</field> .................<field position="4">-1300.00</field> .................<field position="5">0.00</field> ...............</row> ...............<row> .................<field position="1">Text2</field> .................<field position="2">13</field> .................<field position="3">2600</field> .................<field position="4">0.00</field> .................<field position="5">2600.00</field> ...............</row> .............</detail> ...........</break> .........</break> .......</break> .....</invoice> ...</report> </report-set>
When I am in the <break> context (of which there can be any number), I want to output a sum of each field based on the <detail-data> from the top. I've tried to apply-templates on the /report-set/report/detail-data/detail-column which can give me a column for each <detail-column>, but I need to sum from the context where the apply-templates was called. Is this possible? I've hacked a way by passing my context position and break level and going back to look for the break i want, but it's inefficient and hard to read, not to mention ugly.
Does anyone have any ideas? Please tell me there's an easier way!
Mike Partridge..
<report-set>
...<report>
.....<detail-data>
.......<detail-column position="1" dsc="col1" sum_fg="0"/> .......<detail-column position="2" dsc="col2" sum_fg="1"/> .......<detail-column position="3" dsc="col3" sum_fg="1"/> .......<detail-column position="4" dsc="col4" sum_fg="1"/> .......<detail-column position="5" dsc="col5" sum_fg="1"/> .....</detail-data> .....<invoice inv_id="232243"> .......<break level="1"> .........<break level="2"> ...........<break level="3"> .............<detail> ...............<row> .................<field position="1">Text1</field> .................<field position="2">34</field> .................<field position="3">3400.00</field> .................<field position="4">0.00</field> .................<field position="5">3400.00</field> ...............</row> ...............<row> .................<field position="1">Text2</field> .................<field position="2">96</field> .................<field position="3">9600</field> .................<field position="4">0.00</field> .................<field position="5">9600.00</field> ...............</row> .............</detail> ...........</break> ...........<break level="3"> .............<detail> ...............<row> .................<field position="1">Text1</field> .................<field position="2">13</field> .................<field position="3">1300.00</field> .................<field position="4">-1300.00</field> .................<field position="5">0.00</field> ...............</row> ...............<row> .................<field position="1">Text2</field> .................<field position="2">13</field> .................<field position="3">2600</field> .................<field position="4">0.00</field> .................<field position="5">2600.00</field> ...............</row> .............</detail> ...........</break> .........</break> .......</break> .....</invoice> ...</report> </report-set>
When I am in the <break> context (of which there can be any number), I want to output a sum of each field based on the <detail-data> from the top. I've tried to apply-templates on the /report-set/report/detail-data/detail-column which can give me a column for each <detail-column>, but I need to sum from the context where the apply-templates was called. Is this possible? I've hacked a way by passing my context position and break level and going back to look for the break i want, but it's inefficient and hard to read, not to mention ugly.
Does anyone have any ideas? Please tell me there's an easier way!
Mike Partridge..