Discussion:
Multi part mime message in XSLT
Senthilkumaravelan K
2008-06-03 21:12:28 UTC
Permalink
Hi Guys,
Has anyone tried creating Multipart mime message using XSLT.
Assume we have XML data converted into html and text output. Would like to know
is there any style sheet template written already to do this kind of feature.
Any pointers would be of great help.

Thanks,
Senthil

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Mukul Gandhi
2008-06-04 12:59:17 UTC
Permalink
I am a bit sceptical about the useful of this concept. But would be
eager to know why you want to do this.

What do you intend to do with the MIME output from the stylesheet?

I think this should be possible with XSLT. You need to read the MIME
specification[1] to learn about the format, and implement the
stylesheet accordingly.

[1] http://en.wikipedia.org/wiki/MIME
Post by Senthilkumaravelan K
Hi Guys,
Has anyone tried creating Multipart mime message using XSLT.
Assume we have XML data converted into html and text output. Would like to know
is there any style sheet template written already to do this kind of feature.
Any pointers would be of great help.
Thanks,
Senthil
--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Colin Adams
2008-06-04 13:16:47 UTC
Permalink
It seems a perfectly useful concept to me.

<xsl:output method="text" media-type="multipart/mixed">
<xsl:result-document href="mailto:..." >
fill in headers and body of email here
</xsl:result-document>
Post by Mukul Gandhi
I am a bit sceptical about the useful of this concept. But would be
eager to know why you want to do this.
What do you intend to do with the MIME output from the stylesheet?
I think this should be possible with XSLT. You need to read the MIME
specification[1] to learn about the format, and implement the
stylesheet accordingly.
[1] http://en.wikipedia.org/wiki/MIME
Post by Senthilkumaravelan K
Hi Guys,
Has anyone tried creating Multipart mime message using XSLT.
Assume we have XML data converted into html and text output. Would like to know
is there any style sheet template written already to do this kind of feature.
Any pointers would be of great help.
Thanks,
Senthil
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Mukul Gandhi
2008-06-04 13:31:33 UTC
Permalink
Hi Colin,
Thanks for sharing this information.

I have a doubt related to the code fragment you have posted.

I think, media-type="multipart/mixed" is processor specific feature.
Do Gestalt and Saxon support this?

While doing, <xsl:result-document href="mailto:..." > what will happen
after the stylesheet execution finishes?

I think a text output will be created on the standard output, or a
file (if a redirection to file is made). Then will this output to be
manually (or programmaticaly) feeded to some email software? Or the
email client will automatically be triggered as a result of the
instruction, <xsl:result-document href="mailto:..." > (normally as
browser's do). I think, this is again processor specific behaviour.

Could you please comment on my understanding above ...
Post by Colin Adams
It seems a perfectly useful concept to me.
<xsl:output method="text" media-type="multipart/mixed">
<xsl:result-document href="mailto:..." >
fill in headers and body of email here
</xsl:result-document>
--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
David Carlisle
2008-06-04 13:38:43 UTC
Permalink
Post by Mukul Gandhi
I think a text output will be created on the standard output, or a
file (if a redirection to file is made).
No, that would be wrong, either the system handles mailto: URI scheme
(eg by sending mail, for example but any kind of handling is probably
allowed, including i suppsoe sticking the result on standard out, so
perhaps your assertion isn't completely wrong.) then it should handle it
otherwise it should report an error that it doesn't handle it.
Post by Mukul Gandhi
I think, this is again processor specific behaviour.
yes but same is true of any URI scheme, there is no requirement on a
system to support file: or http: schemes for example (either for input
or output)

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Colin Adams
2008-06-04 13:50:30 UTC
Permalink
Gestalt doesn't do anything with the media-type attribute (it probably
should for http, but there is no requirement in the XSLT and
serializations specs).

For mailto (which Gestalt does support), I think it would be rather
difficult for the XSLT processor to insert the header in the right
location, so this is really documentation. The XSLT programmer will be
responsible for ensuring the correct headers and body.

An alternative approach would be a custom serializer - but this would
be even more processor specific (that is, it would be guaranteed
non-portable, whereas the approach I outline here is portable across
all XSLT 2.0 processors that support the mailto URI scheme).
Post by Mukul Gandhi
Hi Colin,
Thanks for sharing this information.
I have a doubt related to the code fragment you have posted.
I think, media-type="multipart/mixed" is processor specific feature.
Do Gestalt and Saxon support this?
While doing, <xsl:result-document href="mailto:..." > what will happen
after the stylesheet execution finishes?
I think a text output will be created on the standard output, or a
file (if a redirection to file is made). Then will this output to be
manually (or programmaticaly) feeded to some email software? Or the
email client will automatically be triggered as a result of the
instruction, <xsl:result-document href="mailto:..." > (normally as
browser's do). I think, this is again processor specific behaviour.
Could you please comment on my understanding above ...
Post by Colin Adams
It seems a perfectly useful concept to me.
<xsl:output method="text" media-type="multipart/mixed">
<xsl:result-document href="mailto:..." >
fill in headers and body of email here
</xsl:result-document>
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Michael Kay
2008-06-04 14:36:07 UTC
Permalink
Post by Mukul Gandhi
I have a doubt related to the code fragment you have posted.
I think, media-type="multipart/mixed" is processor specific feature.
Do Gestalt and Saxon support this?
You can write this, but Saxon doesn't do anything with it.
Post by Mukul Gandhi
While doing, <xsl:result-document href="mailto:..." > what
will happen after the stylesheet execution finishes?
In the case of Saxon, the result document will be supplied to the
OutputURIResolver. The standard OutputURIResolver won't know what to do with
a mailto: URI, but you can supply your own which sends out the email to your
chosen victims.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Mukul Gandhi
2008-06-04 15:56:12 UTC
Permalink
Thanks to all who replied to my questions. I'll explore more about
this topic and would post any findings I might have.
Post by Michael Kay
Post by Mukul Gandhi
I have a doubt related to the code fragment you have posted.
I think, media-type="multipart/mixed" is processor specific feature.
Do Gestalt and Saxon support this?
You can write this, but Saxon doesn't do anything with it.
Post by Mukul Gandhi
While doing, <xsl:result-document href="mailto:..." > what
will happen after the stylesheet execution finishes?
In the case of Saxon, the result document will be supplied to the
OutputURIResolver. The standard OutputURIResolver won't know what to do with
a mailto: URI, but you can supply your own which sends out the email to your
chosen victims.
Michael Kay
http://www.saxonica.com/
--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Senthilkumaravelan K
2008-06-04 16:27:23 UTC
Permalink
Hi ,
Need to create a Multipart mime message to send a email from the system.
Am working on application,which takes xml and transforms into two
separate stylesheet , one to produce text and html output
from there am constructing mime message using Java.

I need help here to convert my output as mime message so that I can
write to socket to generate email .

Thanks,
Senthil
Post by Mukul Gandhi
I am a bit sceptical about the useful of this concept. But would be
eager to know why you want to do this.
What do you intend to do with the MIME output from the stylesheet?
I think this should be possible with XSLT. You need to read the MIME
specification[1] to learn about the format, and implement the
stylesheet accordingly.
[1] http://en.wikipedia.org/wiki/MIME
Post by Senthilkumaravelan K
Hi Guys,
Has anyone tried creating Multipart mime message using XSLT.
Assume we have XML data converted into html and text output. Would like to know
is there any style sheet template written already to do this kind of feature.
Any pointers would be of great help.
Thanks,
Senthil
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Mukul Gandhi
2008-06-04 17:04:40 UTC
Permalink
I am a little confused about the requirement. Do you want to send
email from the XSLT stylesheet?

It seems to me, you have some output from your stylesheet which you
need to email to some address.

To send an email from any environment, you need to send some specific
SMTP commands to a SMTP host to a service listening to port 25. You
cannot do this natively from the XSLT stylesheet, as in XSLT there is
no mechanism (an instruction, or an API) to communicate to hosts via
TCP/IP protocol. You can do this via say Java extension functions.

Constructing a MIME multipart message by hand could be cumbersome, if
for example there are attachments. You would need to understand the
MIME format very well to send all kind of emails correctly.

You can take an easy route by using Java mail API, if you are working
in a Java environment. You can invoke Java mail functions from the
stylesheet as extension functions.
Post by Senthilkumaravelan K
Hi ,
Need to create a Multipart mime message to send a email from the system.
Am working on application,which takes xml and transforms into two
separate stylesheet , one to produce text and html output
from there am constructing mime message using Java.
I need help here to convert my output as mime message so that I can
write to socket to generate email .
Thanks,
Senthil
--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Senthilkumaravelan K
2008-06-04 17:38:10 UTC
Permalink
Hi ,
I am not going to invoke the SMTP commands from xslt, I would like to
apply xslt and get the mime message and write to socket using SMTP
data command.

My expected output ,have HTML and TEXT part .
Sending out mail ,use Java for it.

Hope
Thanks,
Senthil
Post by Mukul Gandhi
I am a little confused about the requirement. Do you want to send
email from the XSLT stylesheet?
It seems to me, you have some output from your stylesheet which you
need to email to some address.
To send an email from any environment, you need to send some specific
SMTP commands to a SMTP host to a service listening to port 25. You
cannot do this natively from the XSLT stylesheet, as in XSLT there is
no mechanism (an instruction, or an API) to communicate to hosts via
TCP/IP protocol. You can do this via say Java extension functions.
Constructing a MIME multipart message by hand could be cumbersome, if
for example there are attachments. You would need to understand the
MIME format very well to send all kind of emails correctly.
You can take an easy route by using Java mail API, if you are working
in a Java environment. You can invoke Java mail functions from the
stylesheet as extension functions.
Post by Senthilkumaravelan K
Hi ,
Need to create a Multipart mime message to send a email from the system.
Am working on application,which takes xml and transforms into two
separate stylesheet , one to produce text and html output
from there am constructing mime message using Java.
I need help here to convert my output as mime message so that I can
write to socket to generate email .
Thanks,
Senthil
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Mukul Gandhi
2008-06-05 01:11:05 UTC
Permalink
Hi Senthil,
I think it will be easier if you perform mail handling
functions/APIs from say Java. You should use XSLT to generate only the
body of the mail. Then feed this mail text to a Java API which can
send the mail.

Personally I wouldn't try to generate a MIME stream from XSLT. Mail
APIs does this for us using user supplied parameters.

On Wed, Jun 4, 2008 at 11:08 PM, Senthilkumaravelan K
Post by Senthilkumaravelan K
Hi ,
I am not going to invoke the SMTP commands from xslt, I would like to
apply xslt and get the mime message and write to socket using SMTP
data command.
My expected output ,have HTML and TEXT part .
Sending out mail ,use Java for it.
Hope
Thanks,
Senthil
--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Senthilkumaravelan K
2008-06-05 04:51:56 UTC
Permalink
Hi Mukul,
Thank you very much . I would pursue this as best practice..


Thanks,
Senthil
Post by Mukul Gandhi
Hi Senthil,
I think it will be easier if you perform mail handling
functions/APIs from say Java. You should use XSLT to generate only the
body of the mail. Then feed this mail text to a Java API which can
send the mail.
Personally I wouldn't try to generate a MIME stream from XSLT. Mail
APIs does this for us using user supplied parameters.
On Wed, Jun 4, 2008 at 11:08 PM, Senthilkumaravelan K
Post by Senthilkumaravelan K
Hi ,
I am not going to invoke the SMTP commands from xslt, I would like to
apply xslt and get the mime message and write to socket using SMTP
data command.
My expected output ,have HTML and TEXT part .
Sending out mail ,use Java for it.
Hope
Thanks,
Senthil
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Colin Adams
2008-06-05 05:14:03 UTC
Permalink
Post by Mukul Gandhi
Personally I wouldn't try to generate a MIME stream from XSLT. Mail
APIs does this for us using user supplied parameters.
It would be very easy to write a module of xsl:functions to do this.

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Mukul Gandhi
2008-06-05 08:57:02 UTC
Permalink
Post by Colin Adams
Post by Mukul Gandhi
Personally I wouldn't try to generate a MIME stream from XSLT. Mail
APIs does this for us using user supplied parameters.
It would be very easy to write a module of xsl:functions to do this.
I agree with you, Colin. I just wanted to say that I would not prefer
to create MIME coded data from the stylesheet.
--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Senthilkumaravelan K
2008-06-05 14:31:08 UTC
Permalink
Hi ,
Could you please give me a sample to understand your views on that ,so
that i could pursue and go from there.
Thanks,
Senthil
Post by Mukul Gandhi
Post by Colin Adams
Post by Mukul Gandhi
Personally I wouldn't try to generate a MIME stream from XSLT. Mail
APIs does this for us using user supplied parameters.
It would be very easy to write a module of xsl:functions to do this.
I agree with you, Colin. I just wanted to say that I would not prefer
to create MIME coded data from the stylesheet.
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Mukul Gandhi
2008-06-06 03:25:04 UTC
Permalink
If I have a Java environment, I would prefer to do:

Java applications, does XSLT transformation -> output in the Java
program itself -> send mail from the same Java program using say, Java
mail API.

If you are clear of the useful of the concept you intend to do, go
ahead and do it ! We are just giving our opinion, which you should or
should not accept.
Post by Senthilkumaravelan K
Hi ,
Could you please give me a sample to understand your views on that ,so
that i could pursue and go from there.
Thanks,
Senthil
--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Michael Ludwig
2008-06-04 17:17:45 UTC
Permalink
Post by Senthilkumaravelan K
Hi ,
Need to create a Multipart mime message to send a email from the
system. Am working on application,which takes xml and transforms into
two separate stylesheet , one to produce text and html output from
there am constructing mime message using Java.
I need help here to convert my output as mime message so that I can
write to socket to generate email .
Converting the output as MIME message should *not* be attempted at the
XSLT level, but rather in the Java code of your application, which calls
the XSL transformation, then assembles the output in a MIME message by
using some Java MIME library (googling for "Java MIME library" turns up
a couple of choices), and then, finally, dispatches the mail message.

Michael Ludwig

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Loading...