Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] What is declarative XML? (And what's not)

From: Rick Jelliffe <rjelliffe@-------.---.-->
To: "Costello, Roger L." <costello@-----.--->
Date: 6/1/2009 7:04:00 AM
Costello, Roger L. wrote:
> Do you agree that this stylesheet document is not a declarative XML document?
>   
I don't think the opposite of "declarative" is really "procedural".  The 
opposite of "procedural" is "functional".  XSLT considered functional, 
not procedural, because functions do not have side effects (variables' 
values cannot be updated.)

The opposite of "declarative" is "algorithmic": declarative says what 
you want, algorithmic says how you do it.

So I think XSLT is declarative when using the template and XPaths, but 
algorithmic when using recursion. You can see that the use of  
<xsl:when> rather than <xsl:if> betrays the concern to try to be as 
declarative as possible.

There are implementation distinctions. The more declarative some program 
is, the more that it can be parallelized and optimized and have 
evaluation re-ordered. This is the same benefit that pure "functional" 
languages have, but "declarative" is not the same as "functional" and 
"algorithmic" is not the same as "procedural".

In your example, I think it is declarative, because there is just an 
identity established, and there is nothing given about how it should be 
implemented. The following two are algorithmic however:
   (map 'sum xpath(  "/purchases/merchandise/cost" ))
or
   int cost[] = get-xpath( current-doc, "/purchases/merchandise/cost" );
   int value = 0;
   for-each (cost) {
         value += cost;
   }

In XSLT you cannot tell how a built-in function is implemented: just 
invoking a function is declarative IMHO.
 
Cheers
Rick Jelliffe

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent