Exploiting FrameMaker MIF as XML, Back into MIF

[Read this for an introduction to what I’m talking about].

The first step of doing anything useful with MX is the ability to get back out into MIF. Thankfully, this is an entirely trivial job in XSLT.

[This code thanks to my boss, Andrew Savikas.]

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
  <!-- author: Andrew Savikas, O'Reilly Media -->

  <xsl:output method="text" encoding="ascii"/>
  <xsl:strip-space elements="_facet"/>

  <xsl:template match="/|MIF_ROOT">

<!-- This template needs to remain flush left for correct output -->
<xsl:template match="_facet">

  <xsl:template match="*">
      <xsl:value-of select="name()"/> 
    <xsl:text> </xsl:text>
    <xsl:text> </xsl:text>

The code is also available here or darcs get http://kfahlgren.com/code/mx/.

Comments are closed.