Documentation Center

IWriteMetadataAndBlobPlugin - BlobSetXmlNode

Sets the text of all the XML nodes (elements or attributes) specified in the OnNodeXPath parameter to the given value. When the nodes or attributes do not exist, they are created. When the nodes already contain text, the OverWrite parameter will allow to overwrite or not.

Plugin Configuration

The following parameters can be configured:
ParameterRequiredDefault valueAllowed valuesDescription
OnNodeXPathYes  XPath expression to select all nodes that have to be processed by the plugin
NodeTypeYes node, attributeThe type of the node to set or to create as a child of the nodes found by the XPath expression in OnNodeXPath
NodeNameYes  The name of the node to set or to create as a child of the nodes found by the XPath expression in OnNodeXPath
OverwriteExistingYes  Specifies what happens if the node with NodeName already exists and has text. When the value is 'No', non-empty texts are not overwritten. When 'Yes', the text is overwritten
ValueYes One of the following can be used to specify the value:
  • A value of type="Parameter". Specifies that the value value comes from a plug-in input parameter. Allowed values: DocId, EDT or ISHType
    
                  <parameter name="Value">
                    <value type="Parameter">DocID</value>
                  </parameter>
                
  • A value of type="DocExtractXPath". Specifies the XPath to be used to extract the value from the current document.
    
                  <parameter name="FirstValue">
                    <value type="DocExtractXPath">(/*[contains(@class,' map/map ')]/@id) | (/*[contains(@class,' topic/topic ')]/@id) | (dita/@id)</value>
                  </parameter>
  • A value of type="MetadataField". Specifies the metadata field to be used as a value.
    
                  <parameter name="Value">
                    <value type="MetadataField">
                      <parameter name="MetadataField">FTITLE</parameter>
                      <parameter name="MetadataFieldLevel">logical</parameter>
                    </value>
                  </parameter>
                
  • A value of type="newGUID". Specifies that the value should be a new GUID value.
    
                  <parameter name="Value">
                    <value type="newGUID"/>
                  </parameter>
                
  • A value of type="newBase62". Specifies that the value should be a new BASE62 value.
    
                  <parameter name="Value">
                    <value type="newBase62"/>
                  </parameter>
                
The value that will be set for the node

plugin name="SETMASTERORMAPID" example

<plugin name="SETMASTERORMAPID" handler="BlobSetXmlNode"  
        ishcondition="CurrentAction in ('Create', 'Update', 'Checkin') and (EDT='EDTXML')">
          <description>Set the id in the master, module or library the same as the DocId provided via metadata, if the id is not there already</description>
          <initialize>
            <parameters>
              <parameter name="OnNodeXPath">
                (/*[contains(@class,' map/map ')]) | (/*[contains(@class,' topic/topic ')]) | (dita)
              </parameter>
              <parameter name="NodeType">attribute</parameter>
              <parameter name="NodeName">id</parameter>
              <parameter name="OverwriteExisting">Yes</parameter>
              <parameter name="Value">
                <value type="Parameter">DocID</value>
              </parameter>
            </parameters>
          </initialize>
        </plugin>

Plugin flow

The plugin will first execute the XPath expression specified in OnNodeXPath.

For every node an xpath expression is excuted:
  • When NodeType="attribute" -> An xpath with "./@<NodeName>" is used.
  • When NodeType="node" -> An xpath with "./<NodeName>" is used.

For every node the text is set (only when text is empty or OverwriteExisting="Yes") or a new node with the text is created with the value taken from the metadata/parameter or a newly generated GUID or Base62.