Content Pipeline Guide > Using ACL with Pipelines and Filters > ACL Pipeline Example
  
ACL Pipeline Example
You can use ACL functions to start publishing when the user interface is unavailable (such as in the Arbortext Publishing Engine) or when running a custom pipeline.
The following example illustrates two ACL functions for HTML publishing, one from an in-memory XML document and one from an on-disk XML file. The functions use the pipeline defined in Arbortext-path\composer\htmlfile.ccf.
#HTMLFileComposer.acl
require _composerlog;
#Produces HTML from an in-memory XML file and an
#XSL stylesheet.
#docId is the ID of the document to process.
#stylesheet is a fully-pathed XSL stylesheet.
#outputFile is a fully-pathed HTML output filename.
#Returns 1 if publishing was successful, 0 otherwise.
function composeToHtmlFromDoc(docId, stylesheet,
outputFile) {
local installPath = main::aptpath;
local ccfParameters[];
local composeStatus;

#Set the catalog path.
compose::composer_set_catalog_path(option("catalogpath"));
#Get the composer for htmlfile.ccf (present in
#the composerpath).
local composer = get_composer(ccfParameters, "htmlfile", docId);

#Set up the parameters.
ccfParameters["stylesheet"] = stylesheet; #stylesheet
#Use only XSL stylesheets in this example.
ccfParameters["stylesheetType"] = "xsl";
ccfParameters["outputFile"] = outputFile;

#the entity substitution file for HTML
ccfParameters["html.entSubFname"] = installPath .
"\\composer\\htmlEntSub.xml";

#The following code creates the directory in which graphics
#are placed and the associated href in the HTML document.
ccfParameters["graphicsHref"] = basename(outputFile) .
".graphics/";
ccfParameters["graphicsPath"] = outputFile .
".graphics\\";

#Start logging.
_composerlog::start_job("HTMLFileComposer");
composeStatus = run_composer(composer, ccfParameters);

if (composeStatus) {
compose::info("Success.");
}
else {
compose::info("Failure.");
}

_composerlog::end_job();
return composeStatus;
}
#Produces HTML from an on-disk XML file and an
#XSL stylesheet.
#inputFile is a fully-pathed XML filename.
#stylesheet is a fully-pathed XSL stylesheet.
#outputFile is a fully-pathed HTML output filename.
#Returns 1 if publishing was successful, 0 otherwise.
function composeToHtmlFromFile(inputFile, stylesheet,
outputFile) {
#Load the file into a Arbortext Editor document. Then,
#call composeToHtmlFromDoc.
local doc = doc_open(inputFile, 0x01 | 0x10 | 0x20 |
0x200 | 0x400);
local composerStatus;
if (!doc_valid(doc)) {
message "Unable to open file $inputFile";
return 0;
}
composerStatus = composeToHtmlFromDoc(doc, stylesheet,
outputFile);
doc_close(doc);
return composerStatus;
}
Set up the catalog path, so all entity files not in the standard install location can be resolved.
compose::composer_set_catalog_path(option("catalogpath"));
For example, a new catalog file is created when you move the xsltransformer.ent entity file to the custom\composer directory. You must call compose_set_catalog_path so the composer will see this catalog file.
The location of the CCF file is not specified. Instead, the get_composer method calls with the name of the composer:
local composer = get_composer(ccfParameters, "htmlfile", docId);
The get_composer method looks for the htmlfile.ccf file in the path specified by the set composerpath command. The default composerpath includes the Arbortext-path\composer directory and the Arbortext-path\custom\composer directory . (Refer to for more information.)
After the composer object is obtained, the pipeline can be run using the run_composer function. This function takes the composer object and an array of parameters. This array can be the array from the get_composer function, with the parameters filled in.
composeStatus = run_composer(composer, ccfParameters);
To ensure proper error logging, you must inform the Event Log of the start and end of the publishing process using the _composerlog::start_job and _composerlog::end_job methods.
#Start logging.
_composerlog::start_job("HTMLFileComposer");
composeStatus = run_composer(composer, ccfParameters);

if (composeStatus) {
compose::info("Success.");
}
else {
compose::info("Failure.");
}

_composerlog::end_job();
return composeStatus;
}
The following example illustrates how to call the ACL functions:
#publish to HTML from Arbortext Editor document
composeToHtmlFromDoc(current_doc(), \
"c:\\arbortext\\editor\\doctypes\\axdocbook\\axdocbook-html.xsl", \
"c:\\document.htm")
#publish to HTML from file
composeToHtmlFromFile("c:\\temp\\file.xml", \
"c:\\arbortext\\editor\\doctypes\\axdocbook\\axdocbook-html.xsl",\
"c:\\file.htm");