XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] A more fundamental concept than functions: units ofcode that self-select

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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS