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

  1. 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,

  2. capture result of initial transformation variable (using nodeset extension or using xslt 2.0), , run count() on determine number of records in it. xsl:copy-of output captured result, followed padding required.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -