April 05, 2007
XSL TransformationsSample Web Application
In our sample application, the user decides on a function to invoke (one of "Factorial," "Fibonacci," "IsPrime" and "nthPrime"), provides the parameter, and clicks on the button corresponding to the desired operation. The basic structure of the code that processes the client input is:
First, the stored "prepackaged" XIM code for the requested computation (whose only missing part is the input parameter value) is loaded into an XmlDocument object and the parameter supplied by the user is inserted into the code at the correct spot. Then the processing instruction indicating the name of the stylesheet (the XIM interpreter) to be applied to the document is inserted into the code. The resulting code in the object is stored in an XML document, and the client browser is redirected to this XML document. To demonstrate what happens when the client supplies a parameter and makes a choice, this code processes a "factorial" request:
See Figure 3 for the result of the interpretation on the client machine of the factorial function, applied to number "20."
[Click image to view at full size]
Figure 3: The result of the computation of 20! executed and displayed on client's browser.
|
|
||||||||||||||||||||||||||||||
|
|
|
|