Krishn60 Posted February 17, 2009 Share Posted February 17, 2009 Hi Forgive me, if I am posting too many questions. I don't know anyting about XSLT and I am asked to do certain task. Thanks for your help in advance.I am trying to pass parameter from within an XSLT code to a function within it. I could see the value of @Comment in the "AAA" line. <xsl:template match="CartoonComment"> <xsl:for-each select="."> <xsl:variable name="wrkComment"> <--------------------------(AAA)------------------------------------> <xsl:call-template name="MODIFYVALUE"> <xsl:with-param name="text" select="@Comment"/> </xsl:call-template> </xsl:variable> NTE||<xsl:value-of select="$wrkComment"/>| </xsl:for-each> </xsl:template>But the value is not going in to the function. When I check the function it is blank at the (BBB) line. Can anyone please tell me what is wrong in me passing on the parameter.<xsl:template name="MODIFYVALUE"> <xsl:param name="tmpwrkField"/> <xsl:value-of select="$tmpwrkField"/> <------------------------(BBB)------------------------- <xsl:variable name="wrkField1"> <xsl:call-template name="SEARCH-AND-REPLACE"> <xsl:with-param name="text" select="$tmpwrkField"/> <xsl:with-param name="replace" select="'&'"/> <xsl:with-param name="by" select="'\T\'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="tmpwrkField1" select="$wrkField1"/> <xsl:variable name="wrkField2"> <xsl:call-template name="SEARCH-AND-REPLACE"> <xsl:with-param name="text" select="$tmpwrkField1"/> <xsl:with-param name="replace" select="'|'"/> <xsl:with-param name="by" select="'\F\'"/> </xsl:call-template> </xsl:variable>.................ThanksKrishnan Link to comment Share on other sites More sharing options...
boen_robot Posted February 17, 2009 Share Posted February 17, 2009 It depends on your XML really, as you're setting your "tmpwrkField" with the value of the "Comment" attribute, on a "CartoonComment" element, like so: <CartoonComment Comment="Some text" /> BTW, remove the for-each, will you? It's redunant, or wose - it may be the reason for the problem. Link to comment Share on other sites More sharing options...
Krishn60 Posted February 17, 2009 Author Share Posted February 17, 2009 No, it didn't work either. My XML code is <AnnimateConversion Catch-up="N"> <Cartoonist> <Cartoon> <Cartoon Data Organization="IH" MRN="01-01-79" DeptNum="" CARNumEXT="5" CARDate="10/03/2002" EnteredBy="ZZ0006" Procedure="" Technique="" BelongClassification="BENIGN" OutsideInstitution="" OutsideDesignID="" Side="L"/> <CartoonComments> <CartoonComment Comment="MASS DISAPPEARED ^ WHEN ~ PUNCTURED | BY NEEDLE."/> </CartoonComments> </Cartoon> </Cartoonist></AnnimateConversion>My intention is to remove the special characters (there may be more than one) in the CartoonComment Comment. It is exactly how you stated. The reason why I used each is because Comment can be of multiple lines under multiple CartoonComment element. Link to comment Share on other sites More sharing options...
Krishn60 Posted February 17, 2009 Author Share Posted February 17, 2009 Fixed it. The error was because of the name in the passing and receiving argument. I changed it to be the same and it worked.Thanks for your help. Link to comment Share on other sites More sharing options...
aalbetski Posted February 17, 2009 Share Posted February 17, 2009 your call<xsl:call-template name="MODIFYVALUE"><xsl:with-param name="text" select="@Comment"/></xsl:call-template>your template<xsl:template name="MODIFYVALUE"><xsl:param name="tmpwrkField"/>your param names are not the same Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.