[om] OpenMath and Imaging

David Carlisle davidc at nag.co.uk
Tue Sep 28 17:49:38 CEST 1999


> 
> 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).

maybe really a question for xsl-list rather than om-list, but since you
ask,

==============mk.xml
<OMA>
  <OMS cd="cartesian-products" name="pair"/>
  <OMV name="a"/>
  <OMV name="b"/>
</OMA>

==============mk.xsl
<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">


<xsl:template match="OMA[OMS[
      position()=1 and 
      @name='pair' and 
      @cd='cartesian-products']]">
  (<xsl:apply-templates select="*[2]"/>,<xsl:apply-templates select="*[3]"/>)
</xsl:template>


<xsl:template match="OMV">
 <xsl:value-of select="@name"/>
</xsl:template>


</xsl:stylesheet>

=================

xt mk.xml mk.xsl 

  (a,b)


David
--
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