[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Compile a transformation description into a largenumber of very simple transformation operations?
- From: "Liam R. E. Quin" <liam@fromoldbooks.org>
- To: "Costello, Roger L." <costello@mitre.org>, "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Thu, 20 Dec 2018 15:09:53 -0500
On Thu, 2018-12-20 at 15:50 +0000, Costello, Roger L. wrote:
> Is there some small set of very simple operations that, when
> combined, can translate any XML vocabulary to another?
What you describe is very similar in principle to the bytecode that
Michael Kay has described as being used in the Saxon product.
> . Possibly the "transformation description" box shown above could be
> much more declarative than, say, a full-fledged XSLT program that
> transforms vocabulary 1 to vocabulary 2.
i am not sure about declarative programming on a spectrum, from "not
declarative" through "suggests being declarative" through "maybe
slightly declarative" all the way to "wonderfully declarative"?
> Have you thought of such things? Is there a small subset of very
> simple XSLT operations that can perform any transformation? Stated
> another way, is there a small subset of very simple XSLT operations
> that is "Turing Complete"? Have you ever created a compiler to output
> a large number of these very simple transform operations?
i've done it in other areas. You can end up with something like,
assembly code though, which is very far from high level.
If you go for something higher level, you end up with XSLT.
If you want something higher level than XSLT, you either end up with
something like XQuery (which isn't really higher level at all) or
something specialized and not generally applicable, or less powerful.
For example, you could write a language that said things like,
element para becomes p
element title becomes h2
element title within document/metadata
becomes title within html/head
if all you had to do was rename elements and move some about. But now
suppose you need to add a total to the order table, add a
class="negative" attribute to all transaction values that are negative,
make mentions of other chapters be links, split the input into a
separate HTML file per chapter with a table of contents... and you
quickly need something more general-purpose, so you're either back to
XSLT, or your higher-level language gets extended,
element qv becomes a link to the corresponding target
with the generated code using the XML Schema to work out which
attribute to use to find the target, perhaps.
I don't know how much mileage there is in this. Maybe it'd end up
replicating the immense, detailed, careful and productive work that the
XSLT Working Group did over the past twenty years.
If you made a language that was high-level enough that the same input
description might work for HTML, JSON, JSON-LD, XML, RDF, then there
might be some interest. But that's quite a challenge, especially given
that you need the language to be usable by people other than its
designer ;)
Liam
--
Liam Quin, https://www.holoweb.net/liam/
Available for XML/Document/Information Architecture/
XSL/XQuery/Web/Text Processing/A11Y training & consulting.
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]