cancel
Showing results for 
Search instead for 
Did you mean: 

Creating nodes in the message at runtime

Former Member
0 Kudos

Hi All,

Source structure of my message is :

<recordset>

<Query></Query>----


0 to unbounded

</recordset>

Target Structure :

<SQL>

<key></key>----


0 to unbounded

</SQL>

Now my requirement is such that....if the source message has 3 Query elements then XI should generate key node in target message 3 times but with names key1,key2,key3.

I am not able to set the names of these target nodes at runtime based on the number of query elements in source message.

Can anybody please help me?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,,

YOu can not change the names of your "Fields".

Hi,

If you want to change Value you can do that by writing UDF.

Enter this code in UDF.

for(int i=0;i<a.length();i++)

{

result.addValue("");

}

Regards,

Akshay Jamgoankar.

    • Reward points if find useful.

Former Member
0 Kudos

Hi,

can you make use of xslt mapping or java mapping

try this xslt code

<?xml version='1.0'?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<sql>

<xsl:apply-templates select="//Query[1]"></xsl:apply-templates>

</sql>

</xsl:template>

<xsl:template match="Query" name="call">

<xsl:param name="count" select="1"></xsl:param>

<xsl:element name="Key{$count}">

<xsl:value-of select="."></xsl:value-of>

</xsl:element>

<xsl:apply-templates select="following::Query[1]">

<xsl:with-param name="count" select="$count + 1"></xsl:with-param>

</xsl:apply-templates>

</xsl:template>

</xsl:stylesheet>