On Fri, 19 May 2006 22:30:20 +0200, Hans Hagen <[EMAIL PROTECTED]> wrote:
> nico wrote: >> On Thu, 18 May 2006 22:02:03 +0200, Hans Hagen <[EMAIL PROTECTED]> wrote: >> >> Just a question about the ctx file as described in the doc: does it mean >> that every XML file is processed first by 'openmath' and then >> 'mathadore'? >> >> If so, why not using the xsltproc piping, avoiding the intermediate .om >> files? >> > i'm not aware of piping ... how does the command look then? Thinking a bit about this, you could avoid using two passes, by merging both stylesheets. The only limitation is the need of the node-set EXSL function (but available in xsltproc by default). Simple example: The main stylesheet (say, x-openmath.xsl): <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="exsl" version='1.0'> <xsl:import href="x-sm2om.xsl"/> <xsl:import href="x-om2cml.xsl"/> <xsl:template match="i|n"> <xsl:variable name="om"> <xsl:apply-imports select="."/> </xsl:variable> <xsl:apply-templates select="exsl:node-set($om)"/> </xsl:template> </xsl:stylesheet> The imported ones: x-sm2om.xsl ----------- <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/> <xsl:template match="i|n"> <xsl:element name="OMOBJ"> <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute> <xsl:attribute name="version">2.0</xsl:attribute> <xsl:value-of select="text()"/> </xsl:element> </xsl:template> </xsl:stylesheet> x-om2cml.xsl ------------ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/> <xsl:template match="OMOBJ"> <xsl:element name="cn"> <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute> <xsl:attribute name="version">2.0</xsl:attribute> <xsl:value-of select="text()"/> </xsl:element> </xsl:template> </xsl:stylesheet> XML file --------- <example> <i>a</i> <i>b</i> <i>c</i> <n>d</n> <i>e</i> </example> xsltproc x-openmath.xsl example.xml It should be checked on the real stylesheets, but it should work. It's nicer than piping commands, and should take less time to process. Regards, BG _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context