[om] OpenMath and Imaging

Ka-Ping Yee ping at lfw.org
Tue Sep 28 18:19:24 CEST 1999

On Tue, 28 Sep 1999, Michael Kohlhase wrote:
> My problem is to write an XSL rule that can do the following: 
> from
> <OMA>
>   <OMS cd="cartesian-products" name="pair"/>
>   <OMV name="a"/>
>   <OMV name="b"/>
> </OMA>
> generate (a,b). The problem here is that the dominance structure of the
> trees is not preserved. I have tried 
> <xsl:template match='OMA/OMS[@cd="cartesian-products" and @name="pair"]'>
>   (<xsl:value-of select="following-sibling"/>,<xsl:value-of select="following-sibling"/>)
> </xsl:template>
> but of course this does not work. The problem is that when you are working
> on the OMA element, you have to do different things based on the choice of
> the function symbol.

If i understand correctly your problem is that you can't express
enough power in XSL to do different things for different compounds.

With MINSE this is trivial because the stylesheets are implemented
in Python.  Using an appropriate notation definition, you would only
have to enter
    'pair(a, b)

to get exactly the same semantics as the above five lines of XML,
and it could be transformed into a rendering like


by the stylesheet.

Also, Python is a heckuva lot easier to write than XSL:

    def _2pair(self, pl, A, B):
        return "@paren(" + xf(99, A) + "@," + xf(99, B) + ")"

With all this "following-sibling" stuff, doesn't it seem that we are
regressing to a prehistoric stage before we learned in first-year
computer science (or earlier) that functions could have arguments?

-- ?!ng

om at openmath.org  -  general discussion on OpenMath
Post public announcements to om-announce at openmath.org
Automatic list maintenance software at majordomo at openmath.org
Mail om-owner at openmath.org for assistance with any problems

More information about the Om mailing list