Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    remove spaces in between strings

    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

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by javaguy1007 View Post
    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:
    Code:
    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

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    use this:
    Code:
    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

    Code:
        <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

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by javaguy1007 View Post
    Thank you ,
    Can I write something like

    Code:
        <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:
    Code:
        <xsl:variable name="myvariable">
    	<xsl:value-of select="translate(item/category, ' ','')/>
          </xsl:variable>
    or
    Code:
        <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).
    Code:
    <xsl:value-of select="$myvariable"/>
    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •