ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Process Server (WID/WPS/WAS+) » XSLT Transformation Primitive

Post new topic  Reply to topic
 XSLT Transformation Primitive « View previous topic :: View next topic » 
Author Message
vasanthapriyas
PostPosted: Tue Aug 25, 2009 5:39 am    Post subject: XSLT Transformation Primitive Reply with quote

Novice

Joined: 05 Jul 2009
Posts: 12

Hi all,

I have used the following xslt code to do translate a field IN Custom option in WID 6.2

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" encoding="UTF-8" indent="yes" xalan:indent-amount="2"/>

<!-- The rule represents a custom mapping: "io3:VehicleNo" to "io3:VehicleNo". -->
<xsl:template name="VehicleNoToVehicleNo" match="sendAutoClaimAdviceRequest">
<xsl:if test="VehicleNo=TN1234">
<xsl:text/>TN01234<xsl:text/>
</xsl:if>

<xsl:value-of select="VehicleNo"/>
</xsl:template>
</xsl:stylesheet>

but the output VehicleNo is empty.

Please help me in fixing the issue.

Note:Input Used(Input and output are of same type)
<sendAutoClaimAdviceRequest>
<VehicleNo>TN1234</VehicleNo>
</sendAutoClaimAdviceRequest>
Back to top
View user's profile Send private message
Ratan
PostPosted: Wed Aug 26, 2009 2:20 am    Post subject: Reply with quote

Grand Master

Joined: 18 Jul 2002
Posts: 1245

<xsl:text/>TN01234<xsl:text/> should be <xsl:text>TN01234</xsl:text>
_________________
-Ratan
Back to top
View user's profile Send private message Send e-mail
vasanthapriyas
PostPosted: Wed Aug 26, 2009 4:06 am    Post subject: Reply with quote

Novice

Joined: 05 Jul 2009
Posts: 12

Hi ,

The below code also didn't work always it goes in to other wise block

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" encoding="UTF-8" indent="yes" xalan:indent-amount="2"/>
<xsl:strip-space elements="*"/>
<!-- The rule represents a custom mapping: "io3:VehicleNo" to "io3:VehicleNo". -->
<xsl:template name="VehicleNoToVehicleNo" match="sendAutoClaimAdviceRequest">
<xsl:choose>
<xsl:when test="VehicleNo!=''">
<xsl:text>Hi</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>pri</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

Can you please explain,what will be input to the custom xslt defined only for one element?will that be a variable in that case how to access it .I feel i go wrong with the xpath.
Back to top
View user's profile Send private message
Ratan
PostPosted: Fri Aug 28, 2009 1:39 am    Post subject: Reply with quote

Grand Master

Joined: 18 Jul 2002
Posts: 1245

Code:

I have used the following xslt code to do translate a field IN Custom option in WID 6.2

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" encoding="UTF-8" indent="yes" xalan:indent-amount="2"/>

<!-- The rule represents a custom mapping: "io3:VehicleNo" to "io3:VehicleNo". -->
<xsl:template name="VehicleNoToVehicleNo" match="sendAutoClaimAdviceRequest">
<xsl:if test="VehicleNo=TN1234">
<xsl:text/>TN01234<xsl:text/>
</xsl:if>

<xsl:value-of select="VehicleNo"/>
</xsl:template>
</xsl:stylesheet>

but the output VehicleNo is empty.



your xsl code should be

Code:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" encoding="UTF-8" indent="yes" xalan:indent-amount="2"/>

<!-- The rule represents a custom mapping: "io3:VehicleNo" to "io3:VehicleNo". -->
<xsl:template name="VehicleNoToVehicleNo" match="sendAutoClaimAdviceRequest">

<xsl:param name="VehicleNo"/>

<xsl:if test="$VehicleNo='TN1234'">
<xsl:text>TN01234</xsl:text>
</xsl:if>


</xsl:template>
</xsl:stylesheet>




Notice the addition of <xsl:param statement and changes in <xsl:if xxx> statement.
you do not need <xsl:value-of xxx> statement.
_________________
-Ratan
Back to top
View user's profile Send private message Send e-mail
Ratan
PostPosted: Fri Aug 28, 2009 1:41 am    Post subject: Reply with quote

Grand Master

Joined: 18 Jul 2002
Posts: 1245

Code:

Hi ,

The below code also didn't work always it goes in to other wise block

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" encoding="UTF-8" indent="yes" xalan:indent-amount="2"/>
<xsl:strip-space elements="*"/>
<!-- The rule represents a custom mapping: "io3:VehicleNo" to "io3:VehicleNo". -->
<xsl:template name="VehicleNoToVehicleNo" match="sendAutoClaimAdviceRequest">
<xsl:choose>
<xsl:when test="VehicleNo!=''">
<xsl:text>Hi</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>pri</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

Can you please explain,what will be input to the custom xslt defined only for one element?will that be a variable in that case how to access it .I feel i go wrong with the xpath.


Add $ in front of VehicleNo in this statement <xsl:when test="VehicleNo!=''">
_________________
-Ratan
Back to top
View user's profile Send private message Send e-mail
vasanthapriyas
PostPosted: Tue Sep 22, 2009 6:00 am    Post subject: Reply with quote

Novice

Joined: 05 Jul 2009
Posts: 12

Hi Ratan,

Thanks for your help .It works
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Process Server (WID/WPS/WAS+) » XSLT Transformation Primitive
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.