During our on-going blog series on Migration Strategies using FrameMaker, we also want to touch on BENEFITS of moving to structure … specifically with FrameMaker.
Our special guest, Chris Desopoulos, brilliantly demonstrated some of the most potent things you can accomplish in XML structure in his recent session on traversing XML-tree structure with ExtendScript. You may view this eSeminar recording by clicking on the title: “Walk the Tree” in XML FrameMaker with ExtendScript.
Download the Files: have your own hands-on
Chris Despopoulos generously provided all of his sample files (including scripts) and his slides, in a convenient pod in the recording. You can actually download these files, avoid taking notes, and “sing along with Chris” by modifying or creating your own Extend Scripts. You will note the 3 files that you can download are present in a pod to the right side of the meeting screen, as pictured in the screen capture to the right.
Fortunately, Chris includes his final ExtendScript, which is a “one-size-fits-all” ExtendScript that will “walk the tree” of your FrameMaker XML and do anything from listing the names of all elements, number the occurrences of specific elements, and more. You will be instructed by the recording how to create simple variables or libraries that your script can “call out” to change to overall results that you will achieve.
“Walking the Tree” — finding specific element instances in FM XML via ExtendScript
As with previous blogs in this series, whenever we highlight an eSeminar recording, we provide a list of MINUTE MARKERS so you can swiftly locate the topic or issue that is most relevant to your specific workflow. You may fast-forward the eSeminar recording to the minutes/seconds indicated below:
- 8:00 Goals of eSeminar
- 9:00 Introduction to ExtendScript User Interface … exploring the dialogue box
- 10:00 Illustrated benefits of Structured FrameMaker documents (XML)
- Discussion of specific examples of how you might wish to use a Script to capture information from XML structure
- 12:00 some uses of structure, e.g. move sections like an “outliner” or have completely automated formatting based on location and content
- 15:00 “What is a Tree?” definition of branching structure, and how XML parallels other branched systems with roots and nodes
- 16:00 BASIC TERMS: definition of basic terms used throughout presentation
- 17:00 What is “walking the tree” or “traversal?”
- 18:00 Simple example of descending tree structure to discover “child” and “sibling” elements (essential to creating a useful path later on)
- 19:00 An example with 3-levels of structure
- 20:00 “Lather, Rinse and Repeat” ..l. the repetitious steps you can easily master to detect structure that you can traverse
- 21:00 The “Droste” effect … identical structure, within structure, within structure
- 21:30 Functions can be Recursive
- 23:30 A visual ExtendScript Example
- 25:30 Invoking the Tree “Walker” script or function
- 27:00 A Glimpse of the actual, unfinished script
- 29:00 DEMO of running unfinished script that has recursive structure
- why you want to avoid this type of “hard code” examples
- 30:00 Passing functions to the script
- 31:00 A book recommendation:
- 37:00 Goals of collecting elements
- 38:15 Example of collecting elements; a variable and an array are required
- 42:00 DEMO of a practical way to count and collect elements
- 42:45 example of benefits of collecting unique elements
- 44:00 Grasping the concept of “is the element unique” and why a negative number “-1” is essential to the script
- 45;00 building the collection
- 46:00 DEMO: examine portion of script to determine unique elements
- 48:00 DEMO: running the actual script to locate and list all unique elements in an EDD
- 50:00 Practical example: locating a specific element within an EDD
- Note: generic elements like [p] for paragraph may appear 100s of times; you may wish to find the instance in the EDD where the [p] element is defined. FrameMaker out-of-the-box, does not have a unique FIND function to accomplish this
- 53:00 DEMO: edit, view the script, add code necessary to locate element name, and then run the script for a practical example
- 60:00 TAKE-AWAY POINTS:
- Structured grows on trees
- Walking the tree is a fundamental activity
- You can use this technique to solve real-world problems
- ExtendScript is a full and rich API into FrameMaker
- You can do this!
Exploring another approach to benefits of ExtendScript
Some of us forget that “Structured FrameMaker” may optionally be used as a proprietary structured editor without XML or DITA. For an excellent example of how ExtendScript may be used in this type of non-XML environment, review an earlier blog which has minute minders to an eSeminar from Russ Ward. You may view the alternate eSeminar by clicking on the title: Squeeze FrameMaker to the Last Drop with ExtendScript.