Subject: RE: [xsl] xslt library usage From: "Diamond, Jason" <Jason.Diamond@xxxxxxx> Date: Fri, 4 May 2001 12:23:08 -0500 |
Hi. Are you getting an error message of some sort? Did you import the library? Does your text node you've selected contain the string 'stringA'? This sample stylesheet shows how to call the str:subst template: <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://xsltsl.sourceforge.net/string" > <xsl:import href="xsltsl-0.2.1/string.xsl"/> <xsl:output method="text" encoding="UTF-8"/> <xsl:template match="/"> <xsl:call-template name="str:subst"> <xsl:with-param name="text" select="'foobarbaz'"/> <xsl:with-param name="replace" select="'bar'"/> <xsl:with-param name="with" select="'quux'"/> </xsl:call-template> </xsl:template> </xsl:transform> Notice that you have to declare the namespace for the string module and import the string module. Change the href to point to wherever you downloaded it to on your local machine. This example assumes it's in a sub-directory of the current directory called "xsltsl-0.2.1". When calling the template, make sure that you prefix the template name with whatever namespace prefix you chose when you declared the string module's namespace. By convention, we use "str" but you can use whatever you like. The above sample works with both MSXML3 and SAXON 6.2. Let me know if you're still having trouble. Jason. > -----Original Message----- > From: Bas Alberts [mailto:bas.alberts@xxxxxxxxxxxx] > Sent: Friday, May 04, 2001 12:45 AM > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' > Subject: [xsl] xslt library usage > > > Hi all. > > I was pointed to the XSLT Standard Library at > http://xsltsl.sourceforge.net/ > where templates are available directly via the XMLNS. For example: > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:str="http://xsltsl.sourceforge.net/string" > version="1.0"> > > The synopsis for the String library's SUBST function is: > <xsl:template name="str:subst"> > <xsl:param name="text"/> > <xsl:param name="replace"/> > <xsl:param name="with"/> > ... > </xsl:template> > > My question is: how should such a template be used? I tried > (variations of) > the following, with Instant-Saxon 6.2.2: > > <xsl:template match="matchXYZ"> > <xsl:call-template name="str:subst"> > <xsl:with-param name="text" select="text()"/> > <xsl:with-param name="replace" select="'stringA'"/> > <xsl:with-param name="with" select="'stringB'"/> > </xsl:call-template> > </xsl:template> > > but was unsuccessful so far. Anyone tried this before? > > Greetings, > basa@work > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xslt library usage, jim | Thread | RE: [xsl] xsl:sort -- XSLT version, Linda van den Brink |
Re: [xsl] no such function: key, Steve Muench | Date | RE: [xsl] How to find the parent., Michael Kay |
Month |