[exslt] Any -complete- examples for the replace function?

Sebastien Boisvert sebastienboisvert at yahoo.com
Thu May 8 22:32:05 MDT 2008


Ok, so here are the template/xmls I've tried to make this work with; I'm using libxslt (comes w/ Mac OS X) through xsltproc command line - maybe someone can test it and explain if I'm not doing something right here.

xsl:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/TR/xhtml1/strict"
                xmlns:str="http://exslt.org/strings"
                extension-element-prefixes="str" >

<xsl:import href="/Users/seb/str.replace.xsl" />
<xsl:variable name="searches" select="document('replace.xml')/replacements" />

<xsl:variable name="search" select="$searches/replacement/@search" />
<xsl:variable name="replace" select="$searches/replacement" />

<xsl:template match="text()">

<xsl:variable name="result" select="str:replace(.,$search,$replace)" />
<xsl:copy-of select="$result" />
<xsl:copy-of select="str:replace(.,$search,$replace)" />
</xsl:template>
</xsl:stylesheet>


source xml:

<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Jani</to></note>


replace.xml referenced in xsl:

<?xml version="1.0"?>
<replacements>
        <replacement search="Jani">Other</replacement>
</replacements>




----- Original Message ----
From: Sebastien Boisvert <sebastienboisvert at yahoo.com>
To: exslt at lists.fourthought.com
Sent: Thursday, May 8, 2008 2:13:24 AM
Subject: Re: [exslt] Any -complete- examples for the replace function?

Anyone?

----- Original Message ----
From: Sebastien Boisvert <sebastienboisvert at yahoo.com>
To: exslt at lists.fourthought.com
Sent: Tuesday, May 6, 2008 1:04:51 AM
Subject: [exslt] Any -complete- examples for the replace function?

Hi all.

Does anyone have a *complete* example on how to properly use the str:replace function? I've tried the sample given at http://lists.fourthought.com/pipermail/exslt/2001-November/000362.html but that's really more of a fragment; I'd like to see a complete example (specifically using node sets) so that I can:

1. confirm that I'm loading the extension in properly
2. confirm if the processor I use is capable of handling it 
3. verify if I'm using it properly

I'm pulling my hair out at this point and it's infuriating to see it work under some conditions but not others, and not have any complete examples to work up from.

Thanks!
Sebastien


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
exslt mailing list
list at exslt.org
http://www.exslt.org/list



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
exslt mailing list
list at exslt.org
http://www.exslt.org/list



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


More information about the exslt mailing list