Thanks Ken, Steve, and Michael for your outstanding feedback. I think that I’ve got it. I’d appreciate it if you (and others) would check my thinking. Please allow me to describe the path that led to my question. When I spoke of “conversion” in my original post, I was thinking of the kind of conversion that a compiler does: convert from one form into an equivalent form (e.g., convert source code into equivalent assembly code). The conversion process
must ensure that the meaning in the source form is preserved in the destination form. Here’s a quote from the compiler book that I am reading[1]: The main aspect of conversion is that the input has a property called semantics – its “meaning” – which must be preserved by the process. As I read that, it occurred to me that oftentimes we have the task of transforming an XML document into another equivalent form. And we expect the transformation process to preserve some property. Isn’t the property that we want preserved
-- semantics? If I write an XSLT program to transform this airport location:
<Airport> <ICAO>KBOS</ICAO> </Airport> into an equivalent airport location, expressed in latitude and longitude, aren’t I expecting the XSLT program to produce a result that refers to the same location; namely, Boston’s Logan airport? That is, don’t I want the conversion process
to preserve the location semantics? I think that I see the fallacy of my thinking. To understand the fallacy we need to compare programs to XML instances. When a program is evaluated it produces a value. [How the program is evaluated is specified in the programming language manual.] That value is the program’s semantics. When my compiler book says that semantics must be preserved, what it
really means is that evaluating the destination code (e.g., assembly code) must produce the same value. If it does, then we say the semantics have been preserved.
However, XML is different. There isn’t the notion of: evaluate the XML instance to produce a value. Further, it is up to an application to decide upon the meaning of the XML instance. Once the application has decided upon a meaning, then
it must ensure that that meaning is preserved in the transformation. For example, if the application decides that the meaning of:
<Airport> <ICAO>KBOS</ICAO> </Airport> is that it expresses the location of an airport, then when it transforms the XML into an equivalent XML where the location is expressed in latitude and longitude:
<Airport> <Latitude>42.3631° N</Latitude> <Longitude>71.0064° W</Longitude> </Airport> the application must ensure that the destination XML refers to the same location as the source XML; namely, both the source XML instance and the destination XML instance refers to Boston’s Logan airport. Thereby the location semantics are
preserved. Does that sound about right? /Roger [1] Modern Compiler Design,
http://www.amazon.com/Modern-Compiler-Design-Dick-Grune/dp/1461446988/ref=sr_1_1?ie=UTF8&qid=1385747695&sr=8-1&keywords=modern+compiler+design
|