0

I am using Convert Query params to XML to convert from JSON to JSONX. The output of this action is stored in Jsonx_Out. I have a transform action with Jsonx_Out as input. Could anyone please help me out how I can read this context. I tried with dp:variable(' var://context/Json_Out'). This does not fetch the value.

Thanks.

Hongbin Wang
  • 1,186
  • 2
  • 14
  • 34
User08
  • 1
  • 2

2 Answers2

0

Well, if it is the input context for your transform action, you can access it as you would any other XML input:

<xsl:template match="/">
    <xsl:apply-templates select="/json:object"/>
</xsl:template>

(Don't forget to define the json namespace.)

You should be able to access a context with dp:variable as you described. I do notice you left out the 'x' in Jsonx_Out -- that may be your issue.

bjimba
  • 928
  • 8
  • 13
0

Are you sure you are getting JSONX?

Query Params outputs a XML so to get a param, eg. param1 from: http://server.com/uri?param1=HelloWorld

You'd use:

<xsl:variable name="param1">
    <xsl:value-of select="/request/args/arg[@name='param1']"/>
</xsl:variable>

The XSL var "param1" would then contain "HelloWorld"

Anders
  • 3,198
  • 1
  • 20
  • 43
  • The OP is correct here. The "Convert Query Parameters to XML" action is used for more than just converting query parameters, but I guess IBM never got around to making its name more generic. One of its uses, as described here, is to convert JSON input to JSONX. – bjimba May 26 '16 at 18:38