How to Extract Job Jacket Information Using XSLT

App Studio offers a variety of support plans to meet your needs. A Bronze Support Plan is included by default with all App Studio plans and provides access to the Knowledge Base, documentation and forums for instant answers 24x7.

Note that personalized support through tickets and Live Chat is only available with Silver and Gold Support Plans – purchasable separately.

If you purchased a Silver or Gold App Studio Support Plan, your Support Center Account will be setup for you by our team within 48 business hours of your plan purchase. An email will be sent to you containing a password reset link, which you need to click on. Please remember to check your Spam folder in the event you do not receive your email.

IMPORTANT: Your Support Center Account is separate to any existing App Studio accounts you may have created in the App Studio Portal. Those login credentials will not work with the Support Center, you will have to be signed up for Support plan to login.

App Studio is the leading cloud-based HTML5 solution that turns print into interactive award-winning tablet and smartphone experiences.

View our Support Plans

Our support team is here to answer all your questions about Quark products including QuarkXPress and Quark Enterprise Solutions. Check out our online knowledge base, documentation site and forums for instant answers 24x7.

If you have a current maintenance plan or are within your free support period you can also contact us directly through our online chat as well as My Support where you can submit tickets and fully manage and track your support history.

If you are a Quark customer and have a current maintenance or support contract we already have your support account setup for you. Please check out our knowledge base article for details on how to get started.

Any new purchase of QuarkXPress includes 60 days of free support and access to the support portal. To get your 60 days of free support you must first register, click here to register your copy of QuarkXPress. Note that it can take 2-3 hours for your support account to activate after registering QuarkXPress. Once active, you will be notified via email.



View our Support and Maintenance Plans

Welcome to Quark's IT Help Desk your single point of contact for assistance with IT related queries. You can create a help desk ticket which will be routed to the appropriate IT Help Desk engineer to research and correct your issue.

Quark's IT Help Desk is committed to providing the support you need to make the most of your every day work experience.

To log a Help Desk ticket, please use the sign in option at the top of the page.

Thank You,

Quark IT Support

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

Procedure:
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='http://www.w3.org/1999/XSL/Transform' 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)'/>
   
</xsl:template>
</xsl:stylesheet>

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

http://server:port/documentname.?jjname=documentnameJJ.&XSL=getJJ.xsl

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='http://www.w3.org/1999/XSL/Transform' ns:JDF='http://www.CIP4.org/JDFSchema_1_1' ns:qxp='http://www.quark.com/QuarkXPress/JDF_1' 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>
 
   </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

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

<? version='1.0' encoding='UTF-8'?>
<xsl:stylesheet ns:xsl='http://www.w3.org/1999/XSL/Transform'
   
ns:JDF='http://www.CIP4.org/JDFSchema_1_1' ns:qxp='http://www.quark.com/QuarkXPress/JDF_1'
   
version='1.0'>
    <xsl:variable
name='jj'>http://localhost:8080/literal/<xsl:value-of select='PROJECT/@JOBJACKET'/></xsl:variable>
    <xsl:variable
name='ticket'><xsl:value-of select='PROJECT/@JOBTICKET'/></xsl:variable>
<xsl:template
match='/'>
    <xsl:element
name='assets'>
    <xsl:for-each
select='document($jj)//qxp:ParaStyle[@ID=//JDF:JDF[@Name=$ticket]//qxp:ParaStyleLink/@rRef]'>
        <xsl:element
name='ParaStyle'>
            <xsl:value-of
select='./@Name'/>
            </xsl:element>
    </xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

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):
 
importPackage(Packages.org..sax);
importPackage(Packages.javax..parsers);
importPackage(Packages.javax..xpath);
load ('QpsFunctions');
 
var ctx = new QRequestContext();
ctx.setDocumentName('Helloworld.qxp');
ctx.setResponseAsURL(true);
var Req = new Request();
Req.setJobJacketPath('helloworldJJ.');
Req.setXSL('file:projectinfo.xsl');
ctx.setRequest(Req);
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) {
            print(result.item(x).getNodeValue());
}
 
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:
 
<?php
$= 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: 2121
Welcome Guest