How a USoft Blend script is processed

Previous Next

This section describes how your USoft Blend script is processed in the typical situation that is it transformed by the Batch.1.0.xsl transformation found in the \xsl\Util subfolder of your USoft installation folder.

The XSLT processor traverses all the XML nodes in document order. Each node encountered is, by default, copied to the result tree or standard output (identity transformation) unless there is a matching XSLT template with a different instruction for that node. This mechanism ensures that all the nodes in the script are visited.

In practice, the nodes in the script are Blend directives: they are such that there will be a template matching them, in which case the functionality associated with the template is executed, as opposed to the node being copied to the result tree.

Like any valid XML document, a USoft Blend script has a document element. This is the top-level element in the script. It can have any element name and is, by default, copied to the result tree. The document element typically contains Blend directives which are executed from top to bottom. The Blend directives do not show up in the return document but they could lead to information, warning and error messages being written to the output. Such messages are output as XML content of the document node.

Example

This script deletes the "deletethis.xml" file from the file system:

<?xml version="1.0" encoding="UTF-8"?>
<mydocument xmlns:pc="Processing.Command">
   <pc:assign workingdir="{directories:Get()}"/>
   <pc:assign deletedfile="{path:Combine($workingdir,'deletethis.xml')}"/>
   <pc:DeleteFile source="{$deletedfile}"/>
</mydocument>

 

When this script is processed:

The <mydocument> element is copied to the standard output.

The "Processing.Command" namespace is declared. This causes the <pc:assign> and <pc:DeleteFile> elements to be qualified as Blend directives.

The workingdir variable is assigned the folder path leading to the working directory.

The deletedfile variable is assigned the file path leading to the file to be deleted.

The file is deleted.

The standard output of the transformation looks like this:

<mydocument>

  <!--files:DeleteFile(c:\myworkingdir\deletethis.xml) -->

</mydocument>

 

 

See also

USoft Blend scripts