Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
3 replies Latest Post - ‏2013-03-29T17:32:45Z by SystemAdmin
SystemAdmin
SystemAdmin
6772 Posts
ACCEPTED ANSWER

Pinned topic Why does var://local show up as var://context/header?

‏2013-03-28T19:59:01Z |
I just spent well over an hour trying to figure out what is wrong with my XSLT... just to find out DataPower isn't putting variables where it has always put them in the past.

I have a simple debugging statement in my XSLT:


<dp:set-variable name=
"'var://local/receivingProviderID'" value=
"$receivingProviderID"/>


And others. Later, I have in the transform:


<ReceivingProviderId><xsl:value-of select=
"dp:variable('var://local/receivingProviderID')"/></ReceivingProviderId>


It wasn't working. Worse, I couldn't see that my local variable was even getting set. Now I'm off on a wild tangent trying to figure out why it wasn't running my XSLT...was I mis-typing something... was my DP working??? I littered my XSLT with dp local variables to try to find out what is happening and scratched my head and examined probe after probe after probe with the right message, but without a single DP local variable getting set. Out of a combination or boredom, frustration, and confusion, I just started clicking and found ALL my dp local variables sitting under the "Context Variables" tab, all of them renamed as "var://context/header/BlahBlahBlah"..... WTF?

So, I change my XSLT to:


<ReceivingProviderId><xsl:value-of select=
"dp:variable('var://context/header/receivingProviderID')"/></ReceivingProviderId>


And it works. Someone please explain to me why/when/how/and under what form of non-schizophrenia circumstances is this happening. This is very, very frustrating.
Updated on 2013-03-29T17:32:45Z at 2013-03-29T17:32:45Z by SystemAdmin
  • Liv2luv
    Liv2luv
    573 Posts
    ACCEPTED ANSWER

    Re: Why does var://local show up as var://context/header?

    ‏2013-03-28T20:10:16Z  in response to SystemAdmin
    That is the way context variables have been operational, atleast as I am aware of.

    var://local/varname refers to a variable called varname. If setting a variable, it is set in the output context of the current stylesheet; if reading one, it is read from the input context.

    Recommend to read thru this useful article: http://www.ibm.com/developerworks/websphere/library/techarticles/0708_maze/0708_maze.html
    • SystemAdmin
      SystemAdmin
      6772 Posts
      ACCEPTED ANSWER

      Re: Why does var://local show up as var://context/header?

      ‏2013-03-28T20:20:07Z  in response to Liv2luv
      I know about the different contexts and places where I can set variables. That's not what is happening. When I set the variable named "var://local/whatever", I am finding the variable in any context "following" the transform in "var://context/header/whatever". Never before has this happened.

      In all other cases (and I have live ones in production right now that work as expected) when I set it local, I find the variable in the probe under "Local Variables". In this case, however, it is showing up in the probe under the "Context Variables" tab.
      • SystemAdmin
        SystemAdmin
        6772 Posts
        ACCEPTED ANSWER

        Re: Why does var://local show up as var://context/header?

        ‏2013-03-29T17:32:45Z  in response to SystemAdmin
        Let me add, too, that this is happening within the exact same XSLT. That is, on line 22 I set the local variable. On line 35 I use it's value. On line 22 I create the variable named as var://local/whatever, and on line 35 I must use var://context/header/whatever to retrieve it.