This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re:Problem w/ call-template
- From: Kim <kimba_40 at yahoo dot com>
- To: xsl-list at lists dot mulberrytech dot com, xsl-list-digest at lists dot mulberrytech dot com
- Date: Thu, 30 May 2002 15:31:15 -0700 (PDT)
- Subject: [xsl] Re:Problem w/ call-template
- Reply-to: xsl-list at lists dot mulberrytech dot com
Thank you both of you for quickly spotting the problem. I closed the template
in the wrong place as Peter pointed out. Nilesh explicitly spelled it out for
me. :>)))
I have made the correction; that fixed the problem. However, somehow, w/ the
existing logic, "originalString" doesn't seem to be passed correctly. It
prints out correctly the "String" where it was selected ( before calling the
template lastSubString. However, the result is empty since the
"originalString" is empty in the template "lastSubString". How do I print out
the "$originalString" in the location marked ***DEBUG: for debugging?
Thanks,
Kim
> Date: Thu, 30 May 2002 07:41:19 +0000
> From: "NILESH PATEL" <jayganesh786@hotmail.com>
> Subject: Re: [xsl] Problem w/ call-template
>
> Hi Kim,
>
> I think even then it will still complain about template name do not match or
> something. I think your xsl fragment should look like this. Correct me if I
> am wrong, as I am not really a master in xsl.
>
> <xsl:template match="String">
> [...]
> <xsl:call-template name="lastSubString">
> <xsl:with-param name="originalString" select="."/>
***DEBUG1:
> </xsl:call-template>
> </xsl:template>
>
> <xsl:template name="lastSubString">
> <xsl:param name="originalString"/>
***DEBUG2:
> <xsl:choose>
> <xsl:when test="contains($originalString,',')">
> <xsl:call-template name="lastSubString">
> <xsl:with-param name="originalString"
> select="substring-after($originalString,',')"/>
> </xsl:call-template>
> </xsl:when>
> </xsl:choose>
> Last substring: <xsl:value-of select="$originalString"/>
> </xsl:template>
>
> See if this works, which I am preety sure(99.9%) will work. Let me know the
> resultplease so I can judge myself.
>
> Thanks, kepp the good work going.
>
> Nilesh Patel
>
>
> >From: Peter Davis <pdavis152@attbi.com>
> >Reply-To: xsl-list@lists.mulberrytech.com
> >To: xsl-list@lists.mulberrytech.com
> >Subject: Re: [xsl] Problem w/ call-template
> >Date: Wed, 29 May 2002 19:53:13 -0700
> >
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >On Wednesday 29 May 2002 16:11, Kim wrote:
> > > Hi,
> > >
> > > I got an error msg: Could not find template named: "lastSubString". It
> >is
> > > from the "***" line. What am I missing here? I checked the spelling;
> >it
> > > is fine.
> >...
> > > </xsl:template>
> > > </xsl:template>
> >
> >You have defined the "lastSubString" template *within* another template.
> >Really you shouldn't have gotten this far -- <xsl:template> must be a
> >top-level element (that is, a child of <xsl:stylesheet>). Simply move the
> >"lastSubString" template outside of the other template and it should work.
> >
> >- --
> >Peter Davis
=====
Kim
*************************
May the force be with you.
*************************
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list