There are many useful FrameMaker plugins out there, but one of my favorites is FrameSLT by West Street Consulting, operated by Russ Ward. I was reminded of how powerful it is when I recently helped a client add structure to a large number of unstructured documents. One issue was a very specific sequence of elements where text nodes needed to be wrapped in <cmdname> elements. In the screenshot below, I have the text nodes indicated by red rectangles. The yellow highlighting indicates the specific context where the text nodes needed to be located.
Doing it by hand would entail searching for <codeph> elements and then visually checking their parent elements to see if the text nodes should be wrapped. This would not be a reasonable approach for hundreds of documents to process. Enter FrameSLT, which allows you to use XPath expressions to search for element/attribute combinations in structured FrameMaker documents. Here is a screenshot of FrameSLT’s “Node Wizard” with the XPath statement in place.
Here is the breakdown of the XPath statement:
//text()
Start at the top of the structure and find unwrapped text nodes.
[parent::codeph]
Make sure the text node is a child of a <codeph> element.
[parent::codeblock]
Make sure the <codeph> element is a child of a <codeblock> element.
[parent::section[@outputclass="cli-syntax"]
Make sure the <codeblock> element is a child of a <section> element, whose outputclass attribute value is “cli-syntax”.
As you can see, XPath lets you be very specific with the elements and attributes that you are trying to locate.
If you look at the lower highlighting on the Node Wizard screenshot above, you can see that FrameSLT lets you perform actions on the elements that it finds. In this case, we want to wrap the text nodes in <cmdname> elements. FrameSLT can perform this operation on hundreds of text nodes in seconds; the results are shown in yellow below.
FrameSLT has a bunch of other useful features that we won’t go into here. Try out the demo version and you will discover more powerful tools for working with structured FrameMaker documents.
One more thing to mention for FrameScript users: FrameSLT can be controlled by FrameScript scripts and FDK clients. This gives you the capability to use XPath in your scripts (and plugins), which greatly simplifies the code required for locating elements and attributes. For more information, visit West Street Consulting.
— Rick
Great post, Rick! Indeed, I’ve heard good things about FrameSLT too.
Yes, yes, yes. FrameSLT as a power tool for anyone who has to maintain structured documents!
Two remarks: If you get more advanced you will notice »Node Wizard Scripts« which allow you to combine multiple element and attribute actions. I recently cleaned up a 1000+ pages book after migrating from format-based to structured FrameMaker and made a screenshot showing 23,000+ successful actions! See
http://cap-studio.de/wp/?p=2121
XPath is powerful, so there are always multiple options to write an expression. To tackle the task above I would have used this expression:
//section[@outputclass=”cli-syntax”]/codeblock/codeph/text()
Spread the word about the power of XPath!
Thank you Rick, a very complimentary and flattering post. To Michael, please stop using it for giant books with a zillion node modifications. You are making me nervous.
Yes, Michael, your XPath expression would likely be more efficient, as well as easier to understand. Thanks for your feedback.
Thanks for the pointer, Rick! In my spare time I’ve been toying around with writing a set of XPath functions for FrameScript. This seems like everything I wanted and more.
No need to worry, Russ. I’ve used FrameSLT (specifically the Node Wizard) for a few years, and it has saved me untold hours of work. Works like a charm.
Also try Mindtouch. I couldn’t get IT to dedicate a server for Framemaker server, they said we were only approved to have “desktop tools” for our jobs. We cut IT out of the loop and spun up an instance of MindTouch 2010 in the cloud (www.mindtouch.com) – No IT involvement and we’re publishing directly to the internet now. And, it ended up being cheaper.
Hi Rick,
Thanks for the BLOG! I learned a lot. I am familar with unstructured Framemaker and start to learn framescript and how to make structure Framemaker. Can you let me know where to start? And do I need to learn Java? Thank you in advance!
AnnB
FrameScript is a good thing to learn for working with both structured and unstructured FrameMaker. FrameScript is a third-party scripting environment for FrameMaker sold by Finite Matters Ltd. Starting with version 10, FrameMaker comes with ExtendScript built in, which is basically Adobe’s version of JavaScript. Most of my recent blog posts deal with ExtendScript. I am partial to FrameScript because I have used it since it was released in the late 90s, but ExtendScript is good too.