[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xslt library usage
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: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|