How are ant % parameters in DITA OT cmd files resolved?

SDL uses .cmd files at the root of the DITA OT which use % definitions. Our custom plugin defines a  -Dakamai.brandname=%8 parameter based on a custom SDL metadata field.  Our ReqMetaDataExportForPublicationXMLForPubObject.xml has been updated to get this metadata.

Where can I see what "%8" parameter is resolving to?  I don't see anything in the .log in the output.   I can't figure out how the connection is being made between the SDL metadata and the ant parameter being defined. 

The cmd file for our custom webhelp format contains this: 

@ECHO OFF
CALL config.cmd
@ECHO OFF
CALL config.custom.cmd
@ECHO OFF

PUSHD %PS_DITAOT%

CALL dita-ot-build.cmd

ECHO ********************************************************************************
ECHO GENERATING REQUESTED OUTPUT USING DITA OPEN TOOLKIT
ECHO ********************************************************************************

REM "%JAVA_HOME%\bin\java" -jar lib/dost.jar /id:"%1" /tempdir:"%1/temp" /i:"%1/%2" /outdir:"%3" /draft:"%5" /filter:"%1\context.ditaval" /copycss:yes /transtype:"%4" /cleantemp:"%6" /validate:"%7"

REM -Ddita.input.valfile=%1\context.ditaval
"ant" -Dtranstype=%4 -Dargs.input=%1/%2 -Doutput.dir=%3 -Ddita.temp.dir=%1/temp -Dargs.draft=%5 -Dclean.temp=%6 -Dvalidate=%7 -Dargs.logdir=%3 -Dakamai.brandname=%8 -logfile %3/%2_%4.log


ECHO ********************************************************************************
POPD
ECHO ON
EXIT

Our custom plugin's build file uses this in a property:

<property name="akamai.brandname" value="${akamai.brandname}" />
<condition property="isATTBrand">
<equals arg1="${akamai.brandname}" arg2="att"/>
</condition>

And then executes the targets based on the property value, using if/unless:

  <target name="akamai-headerfooter-akamai" unless="isATTBrand" >

....

  <target name="akamai-headerfooter-akamai" if="isATTBrand" >

....

Parents
  • Hi Rhonda,

    The % argument representation in the .cmd files which connect DITA-OT to the SDL Tridion Docs environment is using the position specified after the % character.
    So in this case the %8 means that it is using the 8th command line argument specified when calling the .cmd file.

    You can find the construction of the invoking call towards the .cmd file in the supporting vbs-file (name: ISHPublDITAOTUtil.vbs).

    You can find this file in the following location on your server: <drive-letter>:\Infoshare\Data\PublishingService\Tools

    Kind Regards,

    Raf

Reply
  • Hi Rhonda,

    The % argument representation in the .cmd files which connect DITA-OT to the SDL Tridion Docs environment is using the position specified after the % character.
    So in this case the %8 means that it is using the 8th command line argument specified when calling the .cmd file.

    You can find the construction of the invoking call towards the .cmd file in the supporting vbs-file (name: ISHPublDITAOTUtil.vbs).

    You can find this file in the following location on your server: <drive-letter>:\Infoshare\Data\PublishingService\Tools

    Kind Regards,

    Raf

Children
  • Hi Raf, YES!  this was the missing link for me.  Thank you.

    I have an existing Case in this file, and was able to add my new transtype (webhelp-reponsive) to it and add a new field FAKAMAIISPUBLIC.  I simply duplicated the Dim section on FAKAMAIBRANDING (changes in bold below).  I verified that FAKAMAIISPUBLIC is included in my ReqMetaDataExportForPublicationXMLForPubObject.xml file, and added %9Dakamai.ispublic to the DITA-OT-AKAMAIHTML5.cmd located at the root of my DITA OT.  This works, I now have an akamai.ispublic property that I can use.  Yay!  But, i would like to add a new case and having trouble with that (see below).

    Case "akamai-html5-webhelp", "akamai-context-sensitive-help", "webhelp-responsive":
    'Retrieve the stationary and target values
    Dim sBrandName
    If Lcase(gsCombineLanguages) = "yes" Then
    languageArray = GetJobTicketParamAsArray("combine-language")
    sBrandName = Lcase(GetMetadataML(gsPublicationObjectId, "FAKAMAIBRANDING", "lng", languageArray(0)))
    Else
    sBrandName = Lcase(GetMetadata(gsPublicationObjectId, "FAKAMAIBRANDING", "lng"))
    End If

    If iDebug = 1 Then
    wscript.echo "DBG " & csISHPublDITAOTUtilFileName & "::" & csFunctionReference & " -> sBrandName set to [" & sBrandName & "]"
    End If
    Dim sIsPublic
    If Lcase(gsCombineLanguages) = "yes" Then
    languageArray = GetJobTicketParamAsArray("combine-language")
    sIsPublic = Lcase(GetMetadataML(gsPublicationObjectId, "FAKAMAIISPUBLIC", "lng", languageArray(0)))
    Else
    sIsPublic = Lcase(GetMetadata(gsPublicationObjectId, "FAKAMAIISPUBLIC", "lng"))
    End If

    If iDebug = 1 Then
    wscript.echo "DBG " & csISHPublDITAOTUtilFileName & "::" & csFunctionReference & " -> sIsPublic set to [" & sIsPublic & "]"
    End If
    'Command arguments supplied "%1 -> source directory" "%2 -> starting ditamap" "%3 -> output directory" "%4 -> transtype" "%5 -> draft" "%6 -> cleanup" "%7 -> validate"
    'Additional: "%8 -> brandname"
    'Additional: "%9 -> ispublic"
    sCommand = "DITA-OT-AKAMAIHTML5.cmd """ & psDirectory & """ """ & psStartDocFileName & """ """ & gsOutputDir & """ """ & gsTransType & """ """ & sDraftComments & """ """ & sCleanup & """ """ & sValidate & """ """ & sBrandName & """ """ & sIsPublic & """"

    I would like to add a NEW Case, rather than update my existing case, and have that new case point to a different .cmd file in the root of my DITA OT, like the following, but it's failing. Its essentially a copy of the working Case above.  Is there some other step to add a new case to the .vbs file? I have added the %9 parameter to the DITA-OT-WEBHELP-RESPONSIVE.cmd file, just as the DITA-OT-AKAMAIHTML5.cmd has, which is working (p.s. why in the Case is the cmd file name all caps, when the actual filenames are not?).

    Case "webhelp-responsive":
    'Retrieve the stationary and target values
    Dim sBrandName
    If Lcase(gsCombineLanguages) = "yes" Then
    languageArray = GetJobTicketParamAsArray("combine-language") 
    sBrandName = Lcase(GetMetadataML(gsPublicationObjectId, "FAKAMAIBRANDING", "lng", languageArray(0)))
    Else
    sBrandName = Lcase(GetMetadata(gsPublicationObjectId, "FAKAMAIBRANDING", "lng"))
    End If

    If iDebug = 1 Then
    wscript.echo "DBG " & csISHPublDITAOTUtilFileName & "::" & csFunctionReference & " -> sBrandName set to [" & sBrandName & "]"
    End If 
    Dim sIsPublic
    If Lcase(gsCombineLanguages) = "yes" Then
    languageArray = GetJobTicketParamAsArray("combine-language") 
    sIsPublic = Lcase(GetMetadataML(gsPublicationObjectId, "FAKAMAIISPUBLIC", "lng", languageArray(0)))
    Else
    sIsPublic = Lcase(GetMetadata(gsPublicationObjectId, "FAKAMAIISPUBLIC", "lng"))
    End If

    If iDebug = 1 Then
    wscript.echo "DBG " & csISHPublDITAOTUtilFileName & "::" & csFunctionReference & " -> sIsPublic set to [" & sIsPublic & "]"
    End If 
    'Command arguments supplied "%1 -> source directory" "%2 -> starting ditamap" "%3 -> output directory" "%4 -> transtype" "%5 -> draft" "%6 -> cleanup" "%7 -> validate" 
    'Additional: "%8 -> brandname"
    'Additional: "%9 -> ispublic" 
    sCommand = "DITA-OT-WEBHELP-RESPONSIVE.cmd """ & psDirectory & """ """ & psStartDocFileName & """ """ & gsOutputDir & """ """ & gsTransType & """ """ & sDraftComments & """ """ & sCleanup & """ """ & sValidate & """ """ & sBrandName & """ """ & sIsPublic & """"

  • Hi Rhonda,

    My assumption from the code sample above would be that you Dim more than once the same variable.

    Could you check what happens if you remove the 'Dim IsPlublic' and 'Dim sBrandName' from the Case "webhelp-responsive" section.

    Kind Regards,

    Raf