cancel
Showing results for 
Search instead for 
Did you mean: 

How to perform fixed value mapping in XSLT?

Former Member
0 Kudos

Hi All,

Kindly guide me to do a XSLT mapping for fixed values (done in graphical mapping)

eg: if Band Role

A JSE

B SE

and so on.

Kindly help me out to implement the above logic using xslt.

Thanks

Deepika

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

You can create a java class with key value pair and can invoke the same from xslt mapping. This will be fast and will solve your purpose. A Sample code is given below


 <xsl:template name="currentTime"  xmlns:vector="java:java.util.Vector">
          <xsl:variable name="list" select="vector:new()" />
           The Size is <xsl:value-of select="vector:size($list)"/>
     </xsl:template>

Thanks

Amit

jan_krohn
Active Participant
0 Kudos

You can do that with a SAPXML function, for example:

<sapxsl:function name="xxx:convert">

<sapxsl:argument name="string"/>

<sapxsl:result define="sapxsl:if($string='A;','JSE;',sapxsl:if($string='B;','SE;',$string))"/>

</sapxsl:function>

So you have your mapping information separate from the rest of the XSLT, which is not getting so complex then.

Best wishes,

Jan

Former Member
0 Kudos

Hi,,

you can only do this with

a) xsl:if

b) xsl:choose

Regards Mario

Former Member
0 Kudos

Hi Mario,

thanks for the reply. when we have 2 or 3 fields, this will work good.

but my scenario has 10 such fields. will it not be complex if i implement using if and choose ??

Regards

Deepika

Former Member
0 Kudos

Hi Deepika,

yes, it is getting complex. But it is XSLT

Regards Mario

Former Member
0 Kudos

hi Mario,

dont we have any other ways of doing this. if their is no option, i will have to go with this. but just wanted to know if we have any other simple ways

Regards

Deepika

Former Member
0 Kudos

Hi Deepika,

no chance!

Also XSLT 2.0 has no answer to this.

Regards Mario

former_member182455
Active Contributor
0 Kudos

Hi deepika

check this links

Regards

srinivas

Former Member
0 Kudos

Hi,

i referred to the link

but i am not able to get where should we place the XML file.

also i have problem in understanding the xslt code present in this blog.

can u please answer my Quries so that it will helpful for me to implement the same.

Thanks

Deepika

prateek
Active Contributor
0 Kudos

Use xsl-if statement

http://www.w3schools.com/xsl/xsl_if.asp

Regards,

Prateek

Former Member
0 Kudos