xslt - XPath Count Transformed Lines -
i have need append filler records file that's being generated w/ xslt. need round total number of lines in file nearest 10 such if following exists:
fileheader sectionheader detail detail detail sectionfooter filefooter
the total number of lines 7 , need add 3 filler records make:
fileheader sectionheader detail detail detail sectionfooter filefooter [filler record] [filler record] [filler record]
should increment variable in xslt every time write line , use mod math @ end, or there way xslt/xpath know how many lines it's written, such there more reliable function call can make give me count?
there isn't way increment variable in xslt. nor can xslt tell how many lines it's written far (because xslt designed prefer order-of-execution-independence).
instead, can either
do separate computation (e.g. count) of how many records stylesheet should produce through other templates based on input document. easier method, if number of output records equal number of input records, or @ least 1 predicted based on other. or,
capture result of initial transformation variable (using
nodeset
extension or using xslt 2.0), , runcount()
on determine number of records in it.xsl:copy-of
output captured result, followed padding required.
Comments
Post a Comment