def text_from_act(doc)
      # look on the load path for an XSL file for this grammar
      filename = "/slaw/grammars/#{@grammar}/act_text.xsl"

      if dir = $LOAD_PATH.find { |p| File.exist?(p + filename) }
        xslt = Nokogiri::XSLT(File.read(dir + filename))
        xslt.transform(doc).child.to_xml
      else
        raise "Unable to find text XSL for grammar #{@grammar}: #{fragment}"
      end
    end
def text_from_act(doc)
      # look on the load path for an XSL file for this grammar
      filename = "/slaw/grammars/#{@grammar}/act_text.xsl"

      if dir = $LOAD_PATH.find { |p| File.exist?(p + filename) }
        xslt = Nokogiri::XSLT(File.read(dir + filename))
        xslt.transform(doc).child.to_xml
      else
        raise "Unable to find text XSL for grammar #{@grammar}: #{fragment}"
      end
    end
Transform an Akoma Ntoso XML document back into a plain-text version
 suitable for re-parsing back into XML with no loss of structure.