How to Extract Job Jacket Information Using XSLT

Our Technical Support Portal has changed as we have moved to a new platform. Please visit to access your support tickets or to log a new ticket with us. All our existing customers should look for an email from for activation of their New Support Account. If you face any difficulty in accessing the new portal, please write to us at

How to Extract Job Jacket Information Using XSLT

Useful for:

  • Pulling an document from another location and including data from it into another location
  • Extracting a list of all the names of paragraph styles in a project
  • Extracting all the asset names used by a particular project (not just the list of the assets in the entire job jacket), in order to populate a pop-up menu in a web front end to QuarkXPress Server
  • Extracting the most important information for a project or publication from a job jacket

To extract information from a Job Jacket, execute the XSLT procedures described below.

The Document Method: To pull an document from another location and include data from it into another location, run an XSLT similar to this:

<xsl:stylesheet ns:xsl='' version='1.0'>
<xsl:template match='/'>
  <xsl:variable name='jj'>http://localhost:8080/literal/<xsl:value-of select='PROJECT/@JOBJACKET'/></xsl:variable>
<xsl:copy-of select='document($jj)'/>

Once you have run it save it into the docpool as “getJJ.xsl” and then call it with the URL:


The document() method can also be incorporated as part of an XPath. Suppose you want to get a list names of paragraph styles, you can use XSLT to do so in the following manner:

<xsl:stylesheet ns:xsl='' ns:JDF='' ns:qxp='' version='1.0'>
<xsl:template match='/'>
<xsl:variable name='jj'>http://localhost:8080/literal/<xsl:value-of select='PROJECT/@JOBJACKET'/></xsl:variable>
<xsl:for-each select='document($jj)//qxp:ParaStyle'>
<xsl:element name='Parastyle'><xsl:value-of select='./@Name'/></xsl:element>

To extract all the asset names used by a particular project:

<? version='1.0' encoding='UTF-8'?>
<xsl:stylesheet ns:xsl=''
ns:JDF='' ns:qxp=''
name='jj'>http://localhost:8080/literal/<xsl:value-of select='PROJECT/@JOBJACKET'/></xsl:variable>
name='ticket'><xsl:value-of select='PROJECT/@JOBTICKET'/></xsl:variable>

More Information:
All this XSLT is doing is “get me every qxp:ParaStyle, in the document at
http://localhost:8080/literal/<jobjacketname>. <http://localhost:8080/literal/%3cjobjacketname%3e.> , where the ID of that Parastyle (which will be in the global resource pool inside the job jacket) is also referenced as a “qxp:ParaStyleLink” inside the JDF element. The JDF element name is the same as the name of the Job Ticket which I know from my modifier (i.e. the JDF element which relates to this project)”. Note how you can nest the conditions on the XPath, this is a useful functionality that allows you to write some complex logic in a very compact form. Please see the XSLT files attached to this solution for additional XSLT methods and techniques.

Additional Notes:
How would you use this practically? Suppose you had a QPS Script that, for some reason, needed to know all the colors available in a project to ensure it didn’t send an invalid color name in a Modifier request. You could start with the script below  (N.B. assumes the XSLT listed above is saved as “projectinfo.xsl” in the docpool):
load ('QpsFunctions');
var ctx = new QRequestContext();
var Req = new Request();
var response = s_sdkEngine.processRequest(ctx);
print('http://localhost:61400/' response.getResponseURL());
var Doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource('http://localhost:61400' response.getResponseURL()));
var xpath = XPathFactory.newInstance().newXPath().compile('//Color/text()');
var result = xpath.evaluate(Doc, XPathConstants.NODESET);
for (var x = 0; x < result.getLength(); x) {
In this case, the script simply prints all the color names to the console.

Note:  XPath here is being used to easily locate a particular set of elements in the , in this case the “Color” elements.

As an additional example, suppose you wanted to build a website that got information about all the available assets in a project and present them for the user to choose, perhaps the color, and paragraph / character styles for a box, you’d could do that with an (ugly) PHP page something like this:
$= simple_load_file('http://localhost:8080//helloworld.qxp?jjname=helloworldJJ.&XSL=file:projectinfo.xsl');
echo '<html><body><form>Color: <select name='color'>';
foreach($->xpath('//Color') as $node)
  echo  '<option value='' . $node . ''>' . $node . '</option>';
echo '</select><br>';
echo 'Paragraph Style: <select name='parastyle'>';
foreach($->xpath('//ParagraphStyle') as $node) {
  echo  '<option value='' . $node . ''>' . $node . '</option>';
echo '</select><br>';
echo 'Character Style: <select name='charstyle'>';
foreach($->xpath('//CharacterStyle') as $node) {
  echo  '<option value='' . $node . ''>' . $node . '</option>';
echo '</select><br>';
echo '</form></body></html>';

Was this answer helpful?YesNo
Topic Information
  • Topic #: 30026-1637
  • Date Created: 11/20/2012
  • Last Modified Since: 11/20/2012
  • Viewed: 2151
Welcome Guest