1 2 Previous Next 15 Replies Latest reply: Jan 2, 2008 7:47 AM by 604339 RSS

    Watermark in RTF template....

    user531037
      Hi XMLP Gurus,

      Is it possible to code watermark in XMLP by inserting a field and coding the condition in that field. Depending on the condition I can print the watermark text on the output. Is this achievable?

      Thanks in advance...
        • 1. Re: Watermark in RTF template....
          Tim Dexter-Oracle
          Yes, it is. In the RTF template you can create a variable, use the variable name in the MSWord watermark support e.g. $wMark and then assign it the watermark value at runtime. check the user guide for watermark details.
          Regards, Tim
          • 2. Re: Watermark in RTF template....
            user531037
            Hi Tim,

            Thanks for your response.
            As I am new for XLMP, I am unable to pass value in the variable.

            I have created a variable in the field and passed that variable( <?$WATER_M?> ) to the text field in MSWord water mark support.
            <xsl: variable name = "WATER_M">

            Now below this I am trying to code my condition say:
            <?xdofx:if (C_ORDER_NUMBER) = 12345 then $WATER_M = 'MY ORDER' end if?>

            but it is not working.
            I think the syntax I am using to pass value to the variable when the condition is met is wrong. It should print "MY ORDER" as the water mark when the condition is met.

            Can you please correct the syntax.

            Thanks again.
            • 3. Re: Watermark in RTF template....
              Tim Dexter-Oracle
              Hi
              XSL variables are not like say plsql variables, they behave more like constants ie you assign it an initial value and thats it.
              USe the XMLP updatable variables, see the user guide for more details
              Tim
              • 4. Re: Watermark in RTF template....
                604339
                I'm also trying to include a watermark in my rtf that would need to be conditional. Regarding the XMLP variables, do we have an example that is compatible with the MS Word watermark text field? There are plenty of Java references the user guide, but I didn't see an example from RTF.

                I can get Word to pick up an XSL variable, but can't get any IF logic to work around it. Using a set_variable and get_variable also doesn't appear to work so well from a Word watermark perspective (Word didn't successfully do the get_variable when running from Word Format->Background->Watermark->Text).


                Thanks,

                RPP

                Message was edited by:
                user601336
                • 5. Re: Watermark in RTF template....
                  604339
                  Here is the code I'm using to assign the Word Watermark:

                  <xsl:variable name="wMarkCancel" select="'CANCELED'"/>

                  <?if: /PO_DATA/CANCEL_FLAG="Y"?>
                  <xsl:variable name="wMark">
                  <xsl:value-of select="$wMarkCancel"/>
                  </xsl:variable><?end if?>


                  And the value in MS Word in the Watermark Textbox (nav from MS Word: Format->Background->Printed Watermark->Text Watermark):


                  <?$wMark?>


                  Any thoughts or suggestions on how to only get the watermark to appear when a flag is set?

                  Thanks,

                  RPP
                  • 6. Re: Watermark in RTF template....
                    Tim Dexter-Oracle
                    Hey RPP

                    Apologies, I'll takre a look see and get back to you. I have a feeling the watermark value will get evaluated before your 'if' code is so it will always be the default value.
                    I'll check it out.

                    Tim
                    • 7. Re: Watermark in RTF template....
                      604339
                      Tim,

                      I kind of have that impression as well. It looks like the watermark is preprocessed and any if logic wrapped around it is simply ignored, but there has to be a way. Having a watermark that will display when the purchase order is canceled seems like a fairly common requirement. Surely this can't be the first time this functionality has been requested?

                      Thanks,

                      RPP
                      • 8. Re: Watermark in RTF template....
                        604339
                        Tim,

                        Would you have any suggestions?

                        Thanks,

                        RPP
                        • 9. Re: Watermark in RTF template....
                          604339
                          Tim,

                          Are you still looking at this?

                          Thanks,

                          RPP
                          • 10. Re: Watermark in RTF template....
                            Tim Dexter-Oracle
                            Hi Roc

                            Apologies

                            I have come up with a solution that I think will work for you. Its using an if statement but its a new or should I say one that we have not documented yet.

                            <xsl:variable name="wMark" select="xdoxslt:ifelse(.//WM_FLAG='C’,'Canceled','Approved')"/>

                            I have a single variable wMark and I then use the ifelse statment

                            thi sis check the value of the WM_FLAG element, if its a 'C' then assign Canceled otherwise assign Approved to the wMark variable

                            I then have a text watermark

                            <?wMark?>

                            See attached template and XML

                            Will blog this and other watermarking stuff on Monday

                            Tim
                            • 11. Re: Watermark in RTF template....
                              604339
                              Tim,

                              Thanks very much, it works very well for me, and I'll probably frequently use that ifelse functionality as well.

                              RPP
                              • 12. Re: Watermark in RTF template....
                                610513
                                Hi Tim,

                                I have used the above code that you have mentioned for watermark but it is not working properly. Actually the XSL variables behave like constants. so, once the if condition is evaluated first time, the first value 'CANCELED' will be there in 'wMark' variable.. and it is not getting updated. i think we need to use updatable variables..

                                If the above code worked for any one. please tell me clearly how did it work and what was the code exactly. I need it very badly.

                                Thanks
                                KV
                                • 13. Re: Watermark in RTF template....
                                  604339
                                  KV,

                                  The ifelse statement Tim suggested worked fine for me. Here's the actual code I have for a dynamic watermark:

                                  <xsl:variable name="wMark" select="xdoxslt:ifelse(/PO_DATA/CANCEL_FLAG='Y’,'Canceled','')"/>

                                  My code only assigns "Canceled" to the watermark if the flag is set to "Y" and leaves the watermark blank otherwise.

                                  The other Choose and If-Else statements didn't work, but this one does. This is the only example of an xsl variable I've seen where the variable does not behave like a constant and is dynamic (though, technically, the wMark variable is assigned only once in the code).

                                  RPP
                                  • 14. Re: Watermark in RTF template....
                                    610513
                                    RPP,

                                    This is strange.. the same code when i use, is not giving any result.. I mean it is displaying only 'CANCELED' even when the flag is not 'Y' . i will paste the code that i have used.. it is the same..actually..

                                    <xsl:variable name="wMark" select="xdoxslt:ifelse(.//FLAG='B’,'Canceled','')"/>

                                    What is it that you have placed in the watermark text ?? please let me know..
                                    i am using this

                                    <?$wMark?>

                                    THanks,
                                    KV
                                    1 2 Previous Next