...

View Full Version : remove spaces in between strings



javaguy1007
04-08-2009, 04:44 AM
Hi frnds

This forum is very useful for me, as I got solutions to most of questions.
Now I need one more help. I have a string in xml for example "this is my string". My xsl should remove whitespaces in between them . the output should be like "thisismystring"

Thanks
Javaguy

oesxyl
04-08-2009, 05:05 AM
Hi frnds

This forum is very useful for me, as I got solutions to most of questions.
Now I need one more help. I have a string in xml for example "this is my string". My xsl should remove whitespaces in between them . the output should be like "thisismystring"

Thanks
Javaguy
use this:


translate(yourstring,' ','');


bookmark this link:

http://zvon.org/xxl/XSLTreference/Output/index.html

there is a xslt reference and you can find translate to Functions.

best regards

javaguy1007
04-08-2009, 05:49 AM
use this:


translate(yourstring,' ','');


bookmark this link:

http://zvon.org/xxl/XSLTreference/Output/index.html

there is a xslt reference and you can find translate to Functions.

best regards

Thank you ,
Can I write something like



<xsl:variable name="myvariable">
<xsl:value-of select="translate("item/category", ' ','')/>

</xsl:variable>

OR

<xsl:variable name="myvariable">
<xsl:value-of select="translate("@myvariable", ' ','')/>
</xsl:variable>





Please help

oesxyl
04-08-2009, 06:42 AM
Thank you ,
Can I write something like



<xsl:variable name="myvariable">
<xsl:value-of select="translate("item/category", ' ','')/>

</xsl:variable>

OR

<xsl:variable name="myvariable">
<xsl:value-of select="translate("@myvariable", ' ','')/>
</xsl:variable>





Please help
if item/category are tags in your xml, you can assign a value to a variable like this:


<xsl:variable name="myvariable">
<xsl:value-of select="translate(item/category, ' ','')/>
</xsl:variable>

or


<xsl:variable name="myvariable" select="translate(item/category, ' ','')/>

don't quote the tags. When you want to use myvariable you write it like $myvariable, with $ not @( @ is for attributes).


<xsl:value-of select="$myvariable"/>


best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum