xml:if - If xml statement

<xml:if>

If judgment xml statement

Introduce

Use the Xpath expression to determine if the statement is executed.
Coordinate with <xml:elseif> and <xml:else>.

Attribute

test(required)
Using Xpath to judgment the conditions, 
The result is true, then run the code within the xml: if block, 
The result is false, not run.

Symbol
=:equal
!=:not equal
and:and
or:or
trim(optional)
Whether to retain the output value of the front and back blank characters

Property
false:yes(default)
true:no(Including the newline)

Example:

If rule

In test, enter the Xpath expression, the expression return true, if block is executed, if the return is false, skip or enter the next statement soon (such as <xml:elseif> or <xml:else>).

Common judgement symbols

==: equal
!=: not equal
&&: and
||: or
>: greater than
>=: greater than or equal
<: less than
<=: less than or equal
This is a xml file

We transform it to model

(How to transform the xml model, please read: transform xml model)

In the template, we select this model to find the xml model

If the model group is selected, the xml tag need to specify relation

If the model is selected, the xml tag does not need to specify relation

About the usage of xml tag, please read: xml tag

We set variables book1 and book2 and do the following:

Result

trim usage

trim is to judge whether to retain the output value of the front and back blank characters, the default false, that is to say, output all characters.

Example: we get the value of book2'stitle " Learning XML ", with spaces before and after. We do the following:

Result