2 Replies Latest reply: Aug 22, 2012 12:40 PM by Nakur RSS

    OSB, XSLT, Assign and Replace

    427535
      Hi

      We are using OSB and using Assign and Replace over our codes....

      Noticed 2 things:
      Using ASSIGN, created a non-referential variable.... (ie When I am working with a XML (ie $body), if I grab certain parts of it's element, the new variable is a copy of the element and its not a reference therefore any change in the variable does not reflect on $body)... Is this TRUE? Will using an XQUERY function/proc give me a referential context?

      Using a REPLACE/INSERT, the XPATH setting cannot accept a variable ie //targetlist/targetitem[{$idx}]/targetdata.... IS this TRUE? How can variables be used within XPATH?

      Regards,
      Dax
        • 1. Re: OSB, XSLT, Assign and Replace
          plk
          >
          Noticed 2 things:
          Using ASSIGN, created a non-referential variable.... (ie When I am working with a XML (ie $body), if I grab certain parts of it's element, the new variable is a copy of the element and its not a reference therefore any change in the variable does not reflect on $body)... Is this TRUE?
          >
          This is correct. New variable is a copy of the element and its not a reference.

          >
          Will using an XQUERY function/proc give me a referential context?
          >
          Xquery will return a new thing. So, it will not give you a referential context.

          >
          Using a REPLACE/INSERT, the XPATH setting cannot accept a variable ie //targetlist/targetitem[{$idx}]/targetdata.... IS this TRUE? How can variables be used within XPATH?
          >

          Never tried this. Will have to check.

          By the way what exactly is the problem statement. What you want to do?
          • 2. Re: OSB, XSLT, Assign and Replace
            Nakur
            Hi Dax,

            Once you initialize a variable, you will be able to use in all your xPath expressions for the remainder of the flow. If you like to have the value of a specific variable, try using the function data(), i.e.
            //targetlist/targetitem[{data($idx)}]/targetdata

            As far as I know, xPath expressions in a Replace/Insert don't differ from those used in for instance, an Assign


            Regards,
            Ronald

            Edited by: Nakur on Aug 22, 2012 7:38 PM