[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: A more fundamental concept than functions: units ofcode th
On 17/05/2010 23:27, Costello, Roger L. wrote: > Do you agree that self-selecting units of code represents a more fundamental concept than functions? > Not really. the dynamic application provided my xsl:apply templates is clearly a powerful thing and removing that power (and so adding new possibilities for optimisation) is essentially the only difference (other than cosmetic syntax differences) between xquery and xslt. But templates are just functions, with a particular type of overloading. In xpath you can have multiple functions of the same name, which one is applied depends (only) on the number of parameters. That restriction though is merely a language restriction in Xpath not a fundamental restriction on the concept of "function". A great many computer languages allow functions to be overloaded not just on arity but on the type of their arguments. XSLT template matching can be seen (if you want to see it that way) as a generalised form of function overloading not just on the types of the arguments but on arbitrary predicates on the argument. hence your example <xsl:template match="Book[Publisher lt 1970]"> <xsl:template match="Book[Publisher eq 1970]"> <xsl:template match="Book[Publisher gt 1970]"> however the difference between selecting based on type and selecting based on predicates is mostly a matter of viewpoint rather than substance as is the difference between types and predicates http://en.wikipedia.org/wiki/Propositions_as_types_principle David
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
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
|