split-external-text-entities

function

Library: Markup utilities (OMMARKUPUTILITIES)
Import : ommarkuputilities.xmd

Returns: a markup sink to be split


Declaration
export markup sink function
   split-external-text-entities (value markup sink entity-markup,
                                 value markup sink other-markup)
    


Purpose

Use split-external-text-entities to split a markup stream in two, one containing only external text entity references and the other everything else.

Example

In this example we parse an SGML file and split the resulting #content markup stream using split-external-text-entities. The external text entity markup events are sent to markup sink function resolve-entities and the remaining markup to function process-markup.

  import "ommarkuputilities.xmd" unprefixed
  
  define markup sink function
     resolve-entities
  as
     using group "resolve entities"
     do markup-parse #current-input
        output "%c"
     done
  
  define markup sink function
     process-markup
  as
     using group "process markup"
        using output as file "output.txt"
        do markup-parse #current-input
           output "%c"
        done
  
  process
     do sgml-parse document scan file "input.sgml"
        using output as split-external-text-entities (resolve-entities, process-markup)
           output #content
     done
  
  group "resolve entities"
  external-text-entity #implied
     output file "%eq"
  
  group "process markup"
  element #implied
     output "%c"