简体   繁体   中英

Integer to String Convertion in XSLT

In my WSO2 ESB project , I am using xslt files for transformation. I need to manage the type of the values from the endpoint. My payload is JSON and legacy systems's payload is also JSON. I am trying to change the integer value to string value.

Tried to use script in sequence taking payload and using js but I need to manage it in xslt.

For example ;

<xsl:if test="//jsonObject/searchTerm"> <searchTerm><xsl:value-of select="//jsonObject/searchTerm"/></searchTerm> </xsl:if>

searchTerm value is an integer value from the endpoint but i need to transfer it as string to other system. Could you please advise about this issue?

Could you try this,

 <xsl:if test="//jsonObject/searchTerm">
   <searchTerm>@@@<xsl:value-of select="//jsonObject/searchTerm"/></searchTerm>
 </xsl:if>

Check this code:

<xsl:if test="//jsonObject/searchTerm">
   <searchTerm><xsl:value-of select="string(//jsonObject/searchTerm)"/></searchTerm>
</xsl:if>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM