![]() ![]() Var result = processEquation(doc.selectNodes("/equation/*")) This function could be called as shown here: var doc = new ActiveXObject("MSXML2.DOMDocument.4.0") To many, this code is intuitive thanks to the fact that JScript allows you to declare the result variable whose value can be updated within each iteration of the loop. The JScript function in Figure 1 takes a list of nodes that represent the children of the equation element and calculates the result. Using an imperative language that allows you to declare and update variables simplifies the task tremendously. You've probably already worked out in your head how you could solve this problem using an imperative programming language like Visual Basic®, C++, or JScript in conjunction with the DOM. Depending on your background and the way you have handled this in the past, and even on the languages you typically use, you may find some solutions intuitive and others quite foreign. ![]() There are many ways to solve this problem. In this case, it's like evaluating the following equation: ((((3 - 1) * 6) + 8) / 4) = 5 Let's say that the goal is to evaluate the list of operations, top to bottom, assuming no operator precedence and an initial value of 0. NET-supported language can offer the best of both worlds (for an introduction to XSLT see the article that I cowrote with Don Box and John Lam in the August 2000 issue).įor example, consider the following XML document that contains a list of operations to perform: Often extending XSLT with traditional languages like VBScript, JScript®, or any Microsoft®. But at the same time, XSLT's functional programming model can sometimes make it extremely difficult to perform trivial business logic. It can simplify complex transformation logic that would be extremely tedious to implement otherwise. ![]() X SL Transformations (XSLT) is known for making hard things easy and easy things hard. Extending XSLT with JScript, C#, and Visual Basic. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |