R
Rhino
I'm pretty new to XSL. I've only played with it for a few hours very
sporadically over the course of the last few years.
I'm trying to write an XSL that will properly handle a repeating group in my
data but it's not working for me.
Basically, my data consists of 8 unique values, then a single value that can
repeat anywhere from 0 to, say, 50 times. The XML is like this:
<log>
<record>
<timestamp>timestamp-value</timestamp>
<sequence>sequence-value</sequence>
<logger>logger-value</logger>
<level>level-value</level>
<class>class-value</class>
<method>method-value</method>
<thread>thread-value</thread>
<message>message-value</message>
</record>
<record>
<timestamp>timestamp-value</timestamp>
<sequence>sequence-value</sequence>
<logger>logger-value</logger>
<level>level-value</level>
<class>class-value</class>
<method>method-value</method>
<thread>thread-value</thread>
<message>message-value</message>
<param>param1-value</param>
<param>param2-value</param>
<param>param3-value</param>
<param>param4-value</param>
<param>param5-value</param>
</record>
</log>
Most records will be the like the first one and not have any occurrences of
<param>. The remaining records will be like the second one and have several
occurrences of <param>. 50 is not a hard limit on the number of occurrences
of <param> - I'm not sure if there IS any hard limit - but it will be rare
to have more than 50. But I want my code to work for any number of
occurrences even if that is over 50. I'm just saying 50 to give you a sense
of the number of occurrences you typically see.
I want my XSL to create HTML with all records in a table that contains 9
columns: timestamp, sequence, logger, level, class, method, thread, message,
and param.
For records that have no <param> tags, I want the first 8 columns of the
table to contain the specific values of <timestamp> through <message> from
that record. The 9th column of the table should simply be empty.
For records that have <param> tags, I want one row in the table for each
occurrence of a <param> tag in that record. In other words, for the second
record described above, I want to generate five rows in the HTML table
because there are five <param> values. The first of those rows should
contain the <timestamp> thrrough <message> values in the first 8 columns and
the first <param> value in the 9th column. The second row for that record
should contain a single text string like "see above" that spans the first 8
columns with the second <param> record in the 9th column. The third through
nth rows should follow the same pattern as the second row except that they
will show the next <param> value (the third <param> value on the 3rd row,
the 4th <param> value on the 4th row etc.
I've got everything except the repeating group (the <params>) working but
I'm hitting a wall with that. Nothing I try works. It seems clear that I
need a for-each loop on param but I'm not having any luck getting it to
display the different param values.
Can anyone show me the technique I need?
sporadically over the course of the last few years.
I'm trying to write an XSL that will properly handle a repeating group in my
data but it's not working for me.
Basically, my data consists of 8 unique values, then a single value that can
repeat anywhere from 0 to, say, 50 times. The XML is like this:
<log>
<record>
<timestamp>timestamp-value</timestamp>
<sequence>sequence-value</sequence>
<logger>logger-value</logger>
<level>level-value</level>
<class>class-value</class>
<method>method-value</method>
<thread>thread-value</thread>
<message>message-value</message>
</record>
<record>
<timestamp>timestamp-value</timestamp>
<sequence>sequence-value</sequence>
<logger>logger-value</logger>
<level>level-value</level>
<class>class-value</class>
<method>method-value</method>
<thread>thread-value</thread>
<message>message-value</message>
<param>param1-value</param>
<param>param2-value</param>
<param>param3-value</param>
<param>param4-value</param>
<param>param5-value</param>
</record>
</log>
Most records will be the like the first one and not have any occurrences of
<param>. The remaining records will be like the second one and have several
occurrences of <param>. 50 is not a hard limit on the number of occurrences
of <param> - I'm not sure if there IS any hard limit - but it will be rare
to have more than 50. But I want my code to work for any number of
occurrences even if that is over 50. I'm just saying 50 to give you a sense
of the number of occurrences you typically see.
I want my XSL to create HTML with all records in a table that contains 9
columns: timestamp, sequence, logger, level, class, method, thread, message,
and param.
For records that have no <param> tags, I want the first 8 columns of the
table to contain the specific values of <timestamp> through <message> from
that record. The 9th column of the table should simply be empty.
For records that have <param> tags, I want one row in the table for each
occurrence of a <param> tag in that record. In other words, for the second
record described above, I want to generate five rows in the HTML table
because there are five <param> values. The first of those rows should
contain the <timestamp> thrrough <message> values in the first 8 columns and
the first <param> value in the 9th column. The second row for that record
should contain a single text string like "see above" that spans the first 8
columns with the second <param> record in the 9th column. The third through
nth rows should follow the same pattern as the second row except that they
will show the next <param> value (the third <param> value on the 3rd row,
the 4th <param> value on the 4th row etc.
I've got everything except the repeating group (the <params>) working but
I'm hitting a wall with that. Nothing I try works. It seems clear that I
need a for-each loop on param but I'm not having any luck getting it to
display the different param values.
Can anyone show me the technique I need?