‘IF ELSE’ condition in XML publisher

40 pts.
Tags:
Oracle
XML
XML and XML schema
How do I use the 'IF ELSE' condition in XML publisher?

Software/Hardware used:
oracle

Answer Wiki

Thanks. We'll let you know when a new response is added.

XML Publisher supports the common programming construct “if-then-else”. This is extremely useful when you need to test a condition and conditionally show a result. For example:

IF X=0 THEN
Y=2
ELSE
Y=3
END IF

You can also nest these statements as follows:

IF X=0 THEN
Y=2
ELSE
IF X=1 THEN
Y=10
ELSE Y=100
END IF

Use the following syntax to construct an if-then-else statement in your RTF template:

<?xdofx:if element_condition then result1 else result2 end if?>

For example, the following statement tests the AMOUNT element value. If the value is greater than 1000, show the word “Higher”; if it is less than 1000, show the word “Lower”; if it is equal to 1000, show “Equal”:

<?xdofx:if AMOUNT > 1000 then 'Higher'
else
if AMOUNT < 1000 then 'Lower'
else
'Equal'
end if?>

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Oracleapps03
    Thanks! Can you provide any meaningful documents for improving knowledge in XML publisher?
    40 pointsBadges:
    report
  • Softy
    Hi, How to avoid this printing in template if condition is false. The below things should be ignored during printing when the trx_number is null. If any trx_number is there, then these should be printed in the template. How to achieve this? Please help me. "REGISTERED ADDRESS: CP_REGD_ADDR Zip Code: CP_REGD_ZIP_CODE Tel. : CP_REGD_TEL_NUM Fax.: CP_REGD_FAX_NUM"
    10 pointsBadges:
    report
  • Michael Tidmarsh
    29,890 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following