473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

help: xslt2 replace / with \

Can someone help me by providing an example of how to replace / with \
in a string in xslt2.

The characters / and \ seem to cause me grief ...

I am trying the below code currently ...

Any help is appreciated ..

Jim

....
....

<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$buildDir">
</xsl:with-param>
<xsl:with-param name="replace" select="/">
</xsl:with-param>
<xsl:with-param name="with" select="\">
</xsl:with-param>
</xsl:call-template>

....
....

<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="with"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$with"/>
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="with" select="$with"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$replace"/>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

....
....
Apr 26 '06 #1
1 1994
Random Task wrote:
Can someone help me by providing an example of how to replace / with \
in a string in xslt2.

The characters / and \ seem to cause me grief ...


<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$buildDir" />
<xsl:with-param name="replace" select="'/'" />
<xsl:with-param name="with" select="'\'" />
</xsl:call-template>

<xsl:template name="replace-string">
<xsl:param name="text" />
<xsl:param name="replace" />
<xsl:param name="with" />
<xsl:value-of select="translate($text, $replace, $with)" />
</xsl:template>
JW
Apr 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ken Philips | last post by:
If I want to use featurwes of Xslt Spec 2.0: Do I have to use an extension of .xslt2 or can use .xslt as well? Ken
1
by: Harry Zoroc | last post by:
Which Xslt processors (Saxon, Xt, Xalan, msxml) support the new features of xslt2.0? Harry
3
by: silver_sabrina | last post by:
Hey everyone, I'm having some trouble with this. I need to convert one xml doc into another and I think that XSLT may be the answer, so I'd like some help from the gurus out here :) If XSLT cannot...
3
by: binary_sunset | last post by:
Okay... so this may be all to obvious to all except myself, but I am having some difficulty with XML output from Adobe InDesign. Each separate article in my publication is tagged as an article,...
1
by: Thomas Schmidt | last post by:
Hi everybody, can somebody point me to an example / an instruction on how to transform an XML document using Java and XSLT2? Thanks, Thomas
2
by: W. Jordan | last post by:
Hello, It is so bad that .NET 3.0 does not support XSLT2. And there's no news for XSLT2 in .NET 3.5 either. Apart from the Saxon project, is there any .NET component which supports XSLT2? ...
1
by: Christof Hoeke | last post by:
hi, I was wondering if there is any way to use XSLT2 or maybe even XQuery with "normal" CPython. Using Saxon/XSLT2 with Jython is no problem (I have not tried Saxon.NET with IronPython but suspect...
0
by: RolfK | last post by:
Hello All, I'm trying to output an XML node tree in COMMENT tags. Processing is done with XSLT2.0. The output schould be avild xml like this: <root> <e c="some element 1"/> <e c="some...
1
by: RolfK | last post by:
Hello Experts, I have a small problem with copy of CDATA sections. (I'm using XSLT2.0 ) My output target is defined as txt. In my xml source is a CDATA section to be put as it is into the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.