I am running Epic 5.1 on Win2K, and I have a question for anyone out there with extensive userulehook experience.
I currently have a doctype/FOSI that publishes a "full manual" XML document instance. This instance is composed of several dozen elements called <mru>, which is the document fragment that the authors develop and revise. Upon completion of authoring, I import all the mru documents as file entities, and run doc_flatten to turn this into one fully expanded document instance.
One of my processes involves adding a hook for "userulehook" to take the external file written out by the FOSI, rename it to something useful, and place it into the file system at the correct location. The FOSI is set up so that the usetext userule that triggers the external file is at the e-i-c for <mru>, therefore writing an external file for every <mru> in the book (doing it all from one doc removes the overhead of opening and closing each <mru> instance just to run a formatting pass).
My problem is that I cannot seem to get any information from the <mru> as it is formatting for external file generation. Debugging by way of an eval window, I get the string of "/mru" for oid_name(userule_oid), and all my oid_attr() funcs return a -1, but I can get an oid value just fine.
In the FOSI the usetext that produces the external file is set to placemnt="after", so I imagine that once the hook is kicked off by the userule, the formatter is already at the end of the element. Isn't there a way to capture the attribute values of the start tag from that location? I tried oid_logical_mate(), but it returned a string (messy), and so far nothing else seems to work. I know that all the other pieces of the solution work, I tested by using the oid value as the filename (with a gsub(",","_",$mru)), and I can produce a unique set of files per <mru> in the filesystem. I just really needed the attribute values for name and filesystem placement. I can parse the string out if I have to, but I can't help but think there's something i'm missing that would allow me a simple oid_attr().
Thanks in advance...
Jason A. Buss Programmer/Analyst-Product Information Management Processes (316)517-7749 firstname.lastname@example.org "Reports that say something hasn't happened are always interesting to me, because as we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns -- the ones we don't know we don't know." -Donald Rumsfeld
Without actually testing your code, it looks right to me. Use rule hooks are very powerful, they can actually change the content being inserted into the document because the docid is a temporary document that can be edited. But be warned that changing the content can cause an additonal formatting pass because the formatter has to consider the possibility that your change causes page breaks.
The documentation is not very good here, I have already filed a CR internally. The docid parameter is described as "the preliminary index" which is rather misleading. It is a temporary document containing the content that will be inserted into your document if the userulehook returns 1. You can look at the content or even change it.
John Dreystadt Director of Product Management Arbortext