Elements/attributes can be conditionally includes/excluded from the translation process using ezParse. There are two types of conditional statements supported by ezParse; (1) a condition to specify source text within a rule and (2) a condition to specify target text in a rule.

ezParse processes each XML document using a simple Tree-type model and each node (or leaf) of the tree can be referenced using XPath, This ensures that every element/attribute within an XML document can be referenced and used within a conditional rule.

In the following XML document there is an element called column that contains alot of data, however only those with the attribute translate="yes" should be included for translation.

image39.jpg

So a condition to include/exclude each column element in our translation project needs to be added to our ezParse rule.  XPath is used to do this.

conditionalxml.bmp

In the example above, the element column is selected for translation, however the condition @translate="yes" is also specified. This instructs ezParse to include this element for translation only if the attribute translate has the value of "yes". If translate does not match this condition the element will not be included for translation and will be ignored.

If we processed the sample  XML document above using this rule, the following would be included for translation:-

image40.jpg

note.bmp

If an element is selected for translation and no condition is defined, it will always be included for translation when processed by ezParse.

 

What do you want to do?

Create a simple ezParse rule for an XML document.

Learn more about XML Documents.

Learn how to define a translation-target in multi-lingual XML documents.