Subject: RE: replacement example , help
From: henry human <henry_human@xxxxxxxx>
Date: Tue, 29 Mar 2005 15:28:15 +0200 (CEST)
|
hi michael now works fine.
thank you all
--- Michael Kay <mike@xxxxxxxxxxxx> schrieb:
> You misunderstood the message and have integrated
> the new code incorrectly.
>
> You need your original named template, which does
> the string replacement,
> and you need code that invokes it when you get to a
> suitable place in the
> source document. You also need to supply values for
> the parameters. So:
>
> > <xsl:stylesheet version="1.0"
> >
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > <xsl:output method="html"/>
> >
> > <xsl:template match="/">
> > <xsl:apply-templates/>
> > </xsl:template>
>
> <xsl:template match="document">
> <xsl:copy><xsl:apply-templates/></xsl:copy>
> </xsl:template>
>
> <xsl:template match="part1">
> <xsl:call-template name="part1">
> <xsl:with-param name="name" select="name"/>
> <xsl:with-param name="aa" select="'aa'"/>
> <xsl:with-param name="cc" select="'cc'"/>
> </xsl:call-template>
> </xsl:template>
>
> <xsl:template name="part1">
> ... your original code...
> </xsl:template>
>
> </xsl:stylesheet>
>
> Michael Kay
> http://www.saxonica.com/
>
>
> > -----Original Message-----
> > From: henry human [mailto:henry_human@xxxxxxxx]
> > Sent: 29 March 2005 13:37
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: Re: replacement example , help
> >
> > i still becomm error in IE: part1 template has'nt
> > exist.
> > ??
> > here new code as you said:
> >
> > <xsl:stylesheet version="1.0"
> >
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > <xsl:output method="html"/>
> >
> > <xsl:template match="/">
> > <xsl:apply-templates select="part1"/>
> > </xsl:template>
> >
> > <xsl:template match="part1">
> > <xsl:param name="name"/>
> > <xsl:param name="aa"/>
> > <xsl:param name="cc"/>
> > <xsl:choose>
> > <xsl:when test="contains($name,$aa)">
> > <xsl:value-of
> select="substring-before($name,$aa)"/>
> > <xsl:value-of select="$cc"/>
> >
> > <xsl:call-template name="part1">
> > <xsl:with-param name="name"
> > select="substring-after($name,$aa)"/>
> > <xsl:with-param name="aa" select="$aa"/>
> > <xsl:with-param name="cc" select="$cc"/>
> > </xsl:call-template>
> >
> > </xsl:when>
> >
> > <xsl:otherwise>
> > <xsl:value-of select="$name"/>
> > </xsl:otherwise>
> >
> > </xsl:choose>
> >
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> >
> >
> >
> >
> >
> >
> > --- omprakash.v@xxxxxxxxxxxxx schrieb:
> > >
> > >
> > > Hi,
> > > You have a named template and you have
> the
> > > call to the template
> > > inside the named template.
> > >
> > > What you shoud be doing is something like:
> > >
> > > <xsl:template match="/">
> > > <xsl:apply-templates/>
> > > </xsl:template>
> > >
> > > <xsl:template match="part1">
> > > <xsl:call-template name="part1"/>
> > > <xsl:with-param ... etc
> > > </xsl:template>
> > >
> > > You may want to rename your named-template to
> > > something other than part1
> > > though.
> > >
> > > Cheers,
> > > Omprakash.V
> > >
> > >
> > >
> > >
> > >
>
> > >
>
> > >
> > > henry human
>
> > >
>
> > >
> > > <henry_human@ To:
> > > xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>
> > >
> > > yahoo.de> cc:
> > > (bcc: omprakash.v/Polaris)
>
> > >
> > >
> Subject:
> > > replacement example , help
>
> > >
> > > 03/29/2005
>
> > >
>
> > >
> > > 04:31 PM
>
> > >
>
> > >
> > > Please
>
> > >
>
> > >
> > > respond to
>
> > >
>
> > >
> > > xsl-list
>
> > >
>
> > >
> > >
>
> > >
>
> > >
> > >
>
> > >
>
> > >
> > >
> > >
> > >
> > >
> > > hello,
> > > In this xsl styesheet i will replace aa with the
> > > string cc,
> > > what do i wrong ,that
> > > i dont get cc?
> > > thank you to have a look on this stylesheet:
> > >
> > >
> > > <?xml version="1.0"?>
> > > <?xml-stylesheet type="text/xsl"
> > > href="replace.xsl"?>
> > >
> > >
>
=== message truncated ===
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
|