How to get the content of a non-Arbortext PI?

Answered by: Clay Helberg Last Updated: 2006-09-21

=Question=

How can I get the content of a non-Arbortext processing instruction, that is what is called "generic processing instruction" by help 1350)? oid_content just returns an empty string.

=Clay Helberg answers=

You might try using the xpath functions, something along these lines:

local pi_array[]; oid_xpath_nodeset(oid_root, pi_array, '//processing-instruction'); for (pi in pi_array) { goto_oid(pi_array[pi]); name = oid_xpath_string(pi_array[pi], 'name'); text = oid_xpath_string(pi_array[pi], '.'); response("found " . $name . " PI with string content " . $text); }

One thing to watch out for, is that this process won't find most of Epic's built-in PI's, like texmac and caret.

Using the same approach, Clay has also showed how to remove all PIs setting table row heights:

local rowpis[]; oid_xpath_nodeset(oid_root, rowpis, \ "//processing-instruction[name='PubTbl' and starts-with(.,'row rht=')]"); for (i=1; i<=count(rowpis); i++) { oid_delete(rowpis[i]); }
 * 1) remove all PIs like this: <?PubTbl row rht="0.5in"?>