Hi i am into a situation where i need to transform one form of XML to another and then split the file based on threshold limit or via some grouping, mostly succeeded in the implementation but have small confusion with respect to file name.
I want the file name to be sequentially incremented, i tried all sort of option none succeeds, can someone give some heads up on it.
I am also new to XSLT, if you have better approach please feel free to tell me, My goal is to convert one form of XML to another and split the same in multiple file
It might be easier to develop a program using Perl or Korn Shell for this type of processing. XSLT programming can be awkward and restrictive. You basically are programming using XML elements which are translated into code by the XSLT Engine. There are limitations.
Despite its name, you can't modify the value of an <xsl:variable> once it's been created. So incrementing a variable isn't possible.
The usual way to deal with this is to use a recursive template. The number you want should be passed as a parameter; the originating template will pass 1 (or whatever your starting number is) and when the template calls itself it will pass the input parameter plus 1.
You can, apart from conceiving some recursive (named) template to achieve an apparent incremental "loop variable" which is not the easiest to construct in the sense of integrating all the functionalities related to xslt 2.0 grouping and result-document etc...
In your case I would suggest you use a technique of xsl:number for the purpose. Here is a rewritten of your posted template (I have noticed a number of omission or typos?)
Go testing it out, and you may find joyful surprise.
Joined: Jan 08, 2010
Thanks for the replies.
I am using this approach to do my job.
subject: Transforming and Splitting data in a file