Copy link to clipboard
Copied
I want to get concept-outputclass value with extend script ?
Copy link to clipboard
Copied
Hello Jacob,
It is a little unclear what you are asking for:
a) Getting some properties of a File object for an .fm file ?
b) Getting the value of the outputclass attribute on a DITA concept ?
I am guessing you mean to ask the second question. To get an attribute value of an element in any structured file, you need the following code:
function GetAttribute( oElement, sAttribute )
{
/* This function retrieves the value of the named attribute on the element. */
var oaAttrs = oElement.Attributes;
var sRetVal = "";
var i = 0;
var bFound = false;
while( i < oaAttrs.length && !bFound )
{
if( oaAttrs.name == sAttribute )
{
bFound = true;
if( oaAttrs.values.length > 0 )
{
sRetVal = oaAttrs.values[0];
}
}
i++;
}
return sRetVal;
}
Then find the concept element, which is the root of your document:
var oConcept = app.ActiveDoc.MainFlowInDoc.HighestLevelElement;
and get the @outputclass value
var sOutputClass = GetAttribute( oConcept, "outputclass");
Kind regards
4everjang
Copy link to clipboard
Copied
Hi, it works thanks