1

Can anyone please suggest me how to get the following output by performing Transform Binary action:

Here is my input:

STRTYP=HD&STRNBR=0121&PSTLCD=776&MDLNBR=FFGC3010QS 

I have to get the desired output:

<ROOT>
    <STRTYP>HD</STRTYP>
    <STRTYP>0121</STRTYP>
    <STRTYP>776</STRTYP>
    <STRTYP>FFGC3010QS</STRTYP>
</ROOT> 

I have tried by using the FFD File from store:///pkcs7-convert-input.ffd But still I'm not getting the above output.. Please correct me where I have gone wrong in my xslt.

Here is my XSLT:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp">
    <xsl:output method="xml" indent="yes" />
    <xsl:strip-space elements="*" />

    <dp:input-mapping href="store:///pkcs7-convert-input.ffd" type="ffd" />
    <xsl:template match="/">
        <ROOT>
            <STRTYP>
                <xsl:copy-of select="." />
            </STRTYP>
        </ROOT>
    </xsl:template>

    <xsl:template match="args/arg">
        <STRTYP>
            <xsl:apply-templates select="node() | @*" />
        </STRTYP>
    </xsl:template>
    <xsl:template match="/*">
        <ROOT>
            <xsl:apply-templates select="node() | @*" />
        </ROOT>
    </xsl:template>
    <xsl:template match="node() | @*" name="identity">
        <xsl:copy>
            <xsl:apply-templates select="node() | @*" />
        </xsl:copy>
    </xsl:template>
    <xsl:template match="url" />
    <xsl:template match="base-url" />
    <xsl:template match="args">
        <xsl:apply-templates select="node() | @*" />
    </xsl:template>
    <xsl:template match="@*" />
</xsl:stylesheet>
Abel
  • 56,041
  • 24
  • 146
  • 247
sujay
  • 13
  • 2
  • 5
  • Can you show the current output? I am not familiar with [`dp:output-mapping`](http://www-01.ibm.com/support/docview.wss?uid=swg21321379), but from what I read is that, if you configure it correctly, you should at least get some output currently (from the `xsl:copy-of`). In fact, your output is your input, showing it will help us help you with the rest of the stylesheet. – Abel Sep 23 '15 at 11:32

2 Answers2

0

Your code has:

 <xsl:template match="/">
     <ROOT>
         <STRTYP>
             <xsl:copy-of select="." />
         </STRTYP>
     </ROOT>
 </xsl:template>

Since you use xsl:copy-of, no further processing of the other templates will take place, as the copy-of instruction is called when the root node is matched, i.e. at the very beginning.

If I assume for a moment that the current output looks as the input, which would mean you have configured dp:output-mapping correctly, then all you need to do to see a change and to see the other templates applied (if matched), is to replace xsl:copy-of with xsl:apply-templates.

Abel
  • 56,041
  • 24
  • 146
  • 247
0

You can achieve this just by configuration in datapower. You are using incorrect action 'Transform Binary' to achieve this. Rather use 'Convert Query Params to XML' in datapower. You will get desired output automatically.