Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can get just name@javaranch.com without tags in email application??

 
Zoe Peng
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, ya'll,
I am doing a mail application now.
But, I am stuck here since yesterday..plz help..
I have a xsl file.
set a goble variable to pass to another file
<xsl:variable name="FromAddress" >
<xsl:value-of select="./Parties/Party/@Address" />
</xsl:variable>
<!-- which will get the resutl: "Name" <name@javaranch.com> -->
I use value="{$FromAddress}" to pass parameters as reply function in an email application
<!-- I can get the result: "Name" <name@javaranch.com> -->
But, the problem I face is to reuse this value. I need to take this email address as reply email address..
Problem: it takes everything to pass..and
either xml '>' expected or transcoding invalid XML.
I'll just need name@javaranch.com as my parameters..(I use IBMTranscoding Publisher to translate my stylesheet)
how can get just name@javaranch.com
not "Name" <name@javaranch.com>??
in java, u can use String Token to get it, but, how can I do here?? any way?? Thanks in advance.
 
Guillaume Compagnon
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure! there is no StringTokenizer in XSL

(StringTokenizer is not a very performant classe, U know)
Is it not possible for U to have the data in 2 different variables : the name and the email ?
that will be easy to concatenate the two than separate your existing data (perhaps it is not possible in XSL ... XSL is not a very rich language, not as so much than Java)

------------------
---------
Guillaume
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use substring function. In your case it will be:
<xsl:variable name="cleanAddres" select="substring($FromAddress, 2, string-length($FromAddress)-2)"/>

[This message has been edited by Mapraputa Is (edited August 09, 2001).]
 
Zoe Peng
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx.
finally seems a light there..
one more help, plz..
but, how can I know where is the start point?
<xsl:variable name="cleanAddress" select="substring($FromAddress, 2, string-length($FromAddress)-2)"/>
here result
Original== "Mail" <mail@javaranch.com>
Results==> Mail" <mail@yahoo.com
how can I let the parser knows I'll start to get string from <
since different users have different length of email address.
thx again..
Z

 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you need substring-before() and substring-after() functions. You call substring-before() with '>' parameter, and substring-after() with '<', but since you cannot use < symbol in XSLT directly, you escape it as '&lt;'
<xsl:variable name="cleanAddress"
select="substring-before (
substring-after($FromAddress, '&lt;'), '>'
)"/>
[This message has been edited by Mapraputa Is (edited August 09, 2001).]
 
Zoe Peng
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mapraputa,
Thx.
I got it. Everything works fine now. I am ready to check in my codes and complete tasks.
Z
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic