tags:

views:

59

answers:

2

HI all, I have an XML with the different email bodies. I am using xslt to prepare an email template for sending these emails. I also want to include <subject> tag to the xml so that the email is more maintainable.I am using spring to send mail. I need to set the body ans subject of the mail. Body of the mail i am setting by using xslt transformation. I want to set the subject too.Please help me out if you have any idea!! I don't want to use xml parsing just for setting subject.Is there any way i can get the subject value using xslt??

here is my xml:

<mailMessage> <mail type="pinReset"> <subject>Regarding account pin reset</subject> <body> <prefix>Hello User You have initiated a pin reset Please click on the link below to reset your pin</prefix> <suffix>Thank you</suffix> </body> </mail> <mail type="emailUpdate"> <subject>Regarding account email update</subject> <body> <prefix>emailupdated</prefix> <suffix>thank u</suffix> </body> </mail> <mail type="failureCount"> <subject>Regarding account unsuccessful login</subject> <body> <prefix>failureCount</prefix> <suffix>thank u</suffix> </body> </mail> </mailMessage>

I want to fetch the subject separately.

A: 

You could create a second, very simple XSLT template that only outputs the subject line.

Henning
Thanx for the reply.Is there any mechanism to reuse the same xsl for subject too?
sindhu
I wouldn't complicate the XSL with a mode switch, as outputting the body or the subject are completely seperate things. A seperate file for the subject should be about one line.
Henning
A: 

You can pass the string value for the subject, and the mail type as parameters to the XSLT transformation, and the transformation can be written in such a way as to produce the whole email message.

Dimitre Novatchev