Documentation Center

IPublishPostProcessPlugin - DitaDeliveryConvertConditions

Parses XML files and converts InfoShare conditions into conditional elements as required by Dynamic Delivery format.

Plugin Input

Plugin configuration parameters
ParameterRequiredDefault valueAllowed valuesDescription
ObjectTypesToProcessYespageWhich type of objects in the __packages.xml should be parsed to look for conditions. Multiple types need to be separated with ", " (comma+space).
ConvertElementsHavingAttributesNoishcondition, data-ishconditionValid attribute namesThe names of attributes that can contain conditions.
Input expected in the context.Items collection
Item KeyRequiredDefault valueItem Value TypeDescription
TransportPackageRootDirectoryYesstringThe root transport package folder (typically ...\Data\Publish\Data\[RANDOMFOLDERNAME]\work\TP).
ExtendedOverallPackageObjectFilePathYesstringFile path of the XML that contains an overview of all the files that need to be transported to Dynamic Delivery (typically full file path to __packages.xml).

The files that need to be parsed have to be present in the folder provided in the WorkingDirectory property of the context and should contain XML.

Plugin Outcome

Changes made to the file system:
  • Every conditional element in parsed files is wrapped into tcdl:If element. The condition is removed from the original element and placed into the condition attribute of tcdl:If element. The rest of the attributes and the content are preserved.

Values set in the context as a result: None.

Values set in the context.Items collection as a result: None.

plugin name="ISHDITADELIVERYCONVERTCONDITIONS"example


<plugin name="ISHDITADELIVERYCONVERTCONDITIONS" handler="DitaDeliveryConvertConditions">
  <description>Converts remaining conditional attributes to <tcdl:If type="ish:Condition" condition=""> elements</description>
  <initialize>
	<parameters>
	  <parameter name="ObjectTypesToProcess">page, toc</parameter>
	  <parameter name="ConvertElementsHavingAttributes">ishcondition, data-ishcondition</parameter>
	</parameters>
  </initialize>
</plugin>

Example of converting a page file

Original file:

<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head></head>
    <body>
        <div class="body">
            <div class="section" ishcondition="MODEL=330">...</div>
        </div>
    </body>
</html>
		
Converted file:

<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head></head>
    <body>
        <div class="body">
            <tcdl:If type="ish:Condition" condition="(MODEL=330)" xmlns:tcdl="http://www.sdl.com/web/DXA/Format">
                <div class="section">...</div>
            </tcdl:If>
        </div>
    </body>
</html>		

Plugin flow

The DitaDeliveryConvertConditions does the following:
  • Process every file specified in the overall package file provided in the Items collection of the context with the key ExtendedOverallPackageObjectFilePath that has type matching the value provided in ObjectTypesToProcess parameter.
  • Find every element that has a conditional attribute specified ConvertElementsHavingAttributes parameter.
  • Wrap the element into <tcdl:If type="ish:Condition" condition=""> element.
  • Moves the value of the conditional attribute from the original element into the condition attribute of the wrapping element.