Re: Basic program structures in XSLT (was: Re: [xml-dev] Data-driven application --> the data is essentially "machine code" to the application, right?)

"Liam R. E. Quin" <[email protected]>
Newsgroups gmane.text.xml.devel
Message-ID <[email protected]>
On Thu, 2022-12-08 at 10:52 -0700, C. M. Sperberg-McQueen wrote:
> 
> What would you say are the basic control structures for programming
> in XSLT?

Primary tools include -

* Implicit dispatch of templates using apply-templates; this is
central.

* Changing the context with for-each

* Closures and visibility

After that, it's a case of a few main constructs such as xsl:iterate,
xsl:for-each-group (and emphasizing for-each is not a looping
construct), and of course xsl:choose, although that's less important
than it used to be in 1.0 days.

> > Where it gets interesting is when the hierarchic structure of the
> > output doesn't match the hierarchic structure of the input, and
> > Jackson goes into great detail analysing the different types of
> > structure clash and the techniques for dealing with them.
> 
> This provokes a similar but broader question:  are there analogous
> basic principles for program design which can be used to guide
> construction of a transformation in XSLT?

I use a couple of principles here -

Input-completeness: is everything in the input explicitly matched (and
should it be?)

Schema-completeness: is everything that _could_ appear in the input
explicitly matched (and should it be?)

I've written tools to help with both of these questions. But they don't
answer your question completely. So beyond that, it's interesting
(perhaps) to ask at what point, if any, the difference in input and
output structures means apply-templates isn't useful, and why.

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

_______________________________________________________________________

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: [email protected]
subscribe: [email protected]
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.