xsl-list
[Top] [All Lists]

Re: [xsl] replace

2007-06-12 05:53:28
I want to replace "a" by "b" inside "/root/@description" . I'm using XSLT 1.0 as I copied this code example from the web. it's not working with 2.0 either anyways. I'm not restricted to any version. All I need is to be able to replace string .
Thank you


----- Original Message ----- From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Tuesday, June 12, 2007 3:53 AM
Subject: RE: [xsl] replace


I suspect you want select="'a'" and select="'b'".

Why are you still using XSLT 1.0, as a matter of interest? I can understand it if you're in a constrained environment, e.g. in a browser, but if you're
using Saxon then that's clearly not the case. Doing string manipulation in
1.0 when you could be using 2.0 seems like pure masochism to me.

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Charles Ohana [mailto:charles(_dot_)ohana(_at_)buongiorno(_dot_)com]
Sent: 12 June 2007 03:28
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] replace

Hello,
I'm sorry, I know this question has been asked several times
but ... After searching everywhere I could not get the
replace function working.
See my code below you'll see what I'm trying to accomplish.
All I need is a simple working example that is replacing a
pattern withing a value.
Any hint would be appreciated. I'm using SAXON 6.5.5 (java
-jar saxon.jar)

Thank you

<?xml version="1.0" encoding="utf-8"?>
<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform";
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
            xmlns:str="http://exslt.org/Strings"; version="1.0"
            extension-element-prefixes="str">

<import href="functions/replace/str.replace.xsl"/>
<xsl:template match="/">
<xsl:call-template name="str:replace">
   <xsl:with-param name="string" select="/root/@description" />
   <xsl:with-param name="search" select="a" />
   <xsl:with-param name="replace" select="b" />
</xsl:call-template> </xsl:template>

</xsl:stylesheet>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--