I think the code below should work in a Word BI Publisher template, but it's not. When I use the BI Publisher Template Viewer app to test, it is showing Duplicate variable 'branch' definition. If only the matching <?when: ...?> block should be executed, how is the variable defined more than once?
I have experience in other programming languages, but XML/XSL/BIP, etc. is new to me. Can anyone shed some light on the below code?
Thanks!
<?variable:payco; xdoxslt:trim(Remit_to_Name_ID445)?>
<?choose:?>
<?when: $payco=”Company1”?>
<?variable@begin:branch;'CO1'?>
<?end when?>
<?when: $payco=’Company2’?>
<?variable@begin:branch;'CO2'?>
<?end when?>
<?when: $payco=’Company3’?>
<?variable@begin:branch;'CO3'?>
<?end when?>
<?end choose?>
I can think of a few options to solve your logo problem.
Update the data definition SQL to do a decode/concatenation or something to get your logo filename or variable in the SQL as its own field that's extracted into the XML. That way you can use this when determining the image path:
url:{concat('/logos/',branch,'-logo.jpg')}
Use
ifstatements orchoose/whenin your RTF to select an entire image section. This would mean you need to update the RTF every time you add a branch/brand, but it's doable.