I have a requirement in my code and it is as follows:
The
- Parameters in my Java program are passed to an XSLT(X1) for processing. The X1 returns only one String value.
- Another set of Parameters are passed to another XSLT(X2) for processing.The X2 also returns only one String value.
- After Transformations the XSLT results need to be passed to another XSLT(X3) which would use the value as Variables and generate result basis the results from X1 and X2.
As far as i have been studied the XSLT variables values cannot be modified once stored. and also that these values are received as parameters when calling <xsl:apply-template name=”someTemplate” > and with parameter tags.
i can implement this functionality by retrieving the result into String in Java and again Passing them as parameters to the next template. but i wanted to know if the same can be done directly via XSLT.
Please help
Edit: Xalan removed as tag
Yes, here is an XSLT 2.0 example:
When this transformation is applied on the following XML document:
three passes are performed, each with its own parameters. Each pass computes the sum of
numelements, whose value is multiple of the supplied parameter. Finally, the results of the three passes are summed and returned as the final result:Exactly the same transformation can be run with an XSLT 1.0 processor, with the exception that any string
"as='xs:integer'"must be removed from the code.