[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xslt library usage

Subject: RE: xslt library usage
From: "Diamond, Jason" <Jason.Diamond@xxxxxxx>
Date: Fri, 4 May 2001 12:23:08 -0500
xsl str subst
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


Current Thread
  • xslt library usage
    • Bas Alberts - Fri, 4 May 2001 03:44:04 -0400 (EDT)
      • jim - Fri, 4 May 2001 07:43:43 -0400 (EDT)
      • <Possible follow-ups>
      • Bas Alberts - Fri, 4 May 2001 07:56:31 -0400 (EDT)
        • jim - Fri, 4 May 2001 08:03:19 -0400 (EDT)
      • Diamond, Jason - Fri, 4 May 2001 13:22:58 -0400 (EDT) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.