Arbortext Command Language > Functions by Alphabetical Listing > doc_set_stylesheet_association
  
doc_set_stylesheet_association
doc_set_stylesheet_association(doc, i, params[])
This function sets the ith stylesheet association for document doc to have the attribute values specified by the associative array params where the keys of the array elements indicate the attribute name. Valid keys are href, type, title, media, charset, and alternate. The href element should contain a relative path name, an absolute path name, or an http:// URL. Arbortext Editor processes media values of Editor, Print,PDF, and screen. The screen media type is used to designate the HTML file stylesheet.
For example, this function adds screen as a media type to the ith stylesheet association without changing the other fields.
function add_screen_media(i, doc = current_doc())
{
local params[];
if (!doc_get_stylesheet_association(doc, i, params))
{
response("Bad call to doc_get_stylesheet_association in " . caller());
return 0;
}
if (params["media"] != "")
{
params["media"] .= ",";
}
params["media"] .= "screen";
if (!doc_set_stylesheet_association(doc, i, params))
{
response("Bad call to doc_set_stylesheet_association in " . caller());
return 0;
}
return 1;
}
If doc is not a valid document identifier, or if there is no ith stylesheet association for doc, the function returns 0. Otherwise, it returns 1.
If params includes elements with keys other than those listed above, those elements are silently ignored. There is no validation of the contents of any of the params elements.