[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Functional Programming: How do I convert an xsl:f
Thanks everyone for your responses. They have been very enlightening. However, I am struggling to characterize what "functional programming" means. How will I recognize that one XSLT program is written in a functional style while another is not? Let's take an example. Suppose I want to execute Statement 1 if Number is greater than 20, and Statement 2 if Number is greater than 10. Here's one way to implement this: <xsl:choose> <xsl:when test="Number gt 20"> Statement 1 </xsl:when> <xsl:when test="Number gt 10"> Statement 2 </xsl:when> </xsl:choose> Suppose Number has the value 25. If the two xsl:when tests can be executed in any order, then Statement 2 could be executed, which is not what I desire. Thus, I conclude, this xsl:choose is not written in a functional style. Do you agree? Now, let me recast the implementation: <xsl:choose> <xsl:when test="Number gt 20"> Statement 1 </xsl:when> <xsl:when test="(Number gt 10) and (Number le 20)"> Statement 2 </xsl:when> </xsl:choose> Now I get the desired results no matter what order the xsl:when tests are executed. Thus, I conclude, this xsl:choose is written in a functional style. Do you agree? /Roger
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|