OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Procedural vs Declarative XML transformation approaches

[ Lists Home | Date Index | Thread Index ]
  • From: "Thomas B. Passin" <tpassin@home.com>
  • To: xml-dev@lists.xml.org
  • Date: Sat, 04 Nov 2000 16:27:01 -0500

What no one has mentioned so far is the notion that with a
procedural language, you can modify variables  as the
procedure runs so that the way the execution happens depends
on the order of execution.  With the declarative language,
you're not supposed to be able to do this.  You don't
specify execution order.  Of course, you may specify
***document*** order, but that may not be the same.

I'm not all that clear that xslt doesn't have some
procedural aspects, but at least you can't reassign
variables.  I think it is hard for a person who is used to
thinking in one style to switch over to use the other style.
Takes some getting used to.  But it's done all the time
working with sql databases.  Here we take  a perfectly good
declarative query, and we execute triggers (which are
procedures) and FETCH the CURSOR row by row.

Personally, I'd like to leave all the optimization to the
query optimizer, but sometimes I have to help it by adding
redundant clauses to a query.  I'll be glad if that need
goes away in the future.

Presumably, at some point we'll have query rewriters and
optimizers in xslt processors (well, yes, xt already does
some optimizations as I have read).

Cheers,

Tom Passin

Matt Sergeant wrote -


> On Sat, 4 Nov 2000, Tim Bray wrote:
>
> > At 06:05 PM 04/11/00 +0000, Matt Sergeant wrote:
> > > Basically, procedural
> > >code is great for data oriented XML structures, but
almost useless for XML
> > >mixed content. For mixed content you really need
declarative code.
> >
> > Wow; a neat bifurcation of the universe.  I wish life
were that
> > simple.  Suffice it to say that many will disagree with
this
> > particular pair of broad brush strokes. -Tim
>
> Go on then, disagree :-)
>
> I make careful note that a stream based parser that says:
>
>   if (element == 'foo') {
>     ...
>   }
>   elsif (element == 'bar') {
>     ...
>   }
>
> is also declarative, as would be a DOM based parser that
walks the DOM
> tree with some sort of iterator doing something similar.
By procedural I
> mean something that says:
>
> foreach foo element
> output "foo: "
> foreach bar element child of foo
> output " = "
> foreach text child of bar
> output the text
>
> Mapping that model to mixed content is, umm, difficult, to
say the least.
>





 

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

Copyright 2001 XML.org. This site is hosted by OASIS