RocketSled: Making the Art of Creating XPATH Statements Simple
Posted by Rick Schochler on Wed, Jan 25, 2012 @ 12:36 PM
As you will hopefully notice in the coming days, our “baby”, RocketSled™, is now commercially available. We’re very excited about this chapter in our company. For those not yet in the know, RocketSled is our XML editor in MS Word. It compromises nothing in the way of an XML editor (you can use any XML schema), and gives you a bunch of features and functionalities by simply residing in Word. For example, and as mentioned elsewhere on this site, you can quickly generate a fully formatted PDF file of your XML document…no XSLT or XSL-FO required.
Ease of use is why we created RocketSled in the first place. The promise of XML more than 10 years ago was to be ubiquitous. While used in ways not thought of when it was rolled out to the public, one would be hard pressed to describe XML, in so far as creating content, as ‘ubiquitous’. Obviously, we hope that tags-off authoring in the friendly confines of Word, along with the ease of formatting and printing data, will help finally accomplish this goal. Toward that end, one of our lead developers, Mel Bobadilla, has been working on an application that we just recently integrated into RocketSled: XPATH Common Language Editor (our marketing team is working on a sexier name...I’ll let you know when they’ve found one).
As stylesheet designers are keenly aware, in order to format XML elements differently, depending on context, one must employ XPATH statements within their stylesheets. For example, to format the title of chapters differently than the titles of sections within a book, one might begin with the following XPATH statements:
- book/chapter/title
- book/chapter/section/title
As XPATH gurus will know, there are several ways to write the above statements. Two obvious ways are:
- title[parent::chapter]
- title[parent::section]
The ability to style the text of elements depending on context is a key requirement within RocketSled. However, in keeping with our mantra of keeping it simple, we did not want our users of RocketSled to have to learn XPATH in order to style a document.
Our Common Language Editor is a GUI-based means of building XPATH statements. It’s tied to a particular schema, so it’s aware of its context/location at all times. Here is a screen shot of us using it within RocketSled to build an XPATH statement:

To get this screen capture, we selected the title element within what we are calling “Derivations”. Then, in this case, Mel dictated that he wanted to create a style for titles that had a parent of either Section or Chapter. He could’ve also created a separate XPATH statement for each. He then clicked on the ‘Source’ element so that we could see the actual XPATH statement that was generated. Notice the several options that are available for building XPATH statements: parent, ancestry, ancestry count, and attribute. I personally think that this is about as easy as it gets with respect to building XPATH statements and I’m glad we now have it working within RocketSled!
Please post a comment or email me at rschochler@crowsol.com with any and all questions!