Xml + xsl = html for email ??

Discussion in 'Web Design & Coding' started by Complete, Dec 12, 2008.

  1. Complete

    Complete OSNN Addict

    Messages:
    94
    XML can do a very cool trick.

    If you include the name of an XSL file in the XML file, you can produce what looks just like a formatted HTML file when you load the XML file into a browser.

    The question I have is this. How would you actually produce an actual HTML file that can be sent as a formated email by using this XML and XSL combo?

    Let me put it another way.

    First of all, consider this. Email has the capacity to send HTML formated text.

    Second of all, consider this. XML along with a stated XSL style sheet can be loaded into a browser to produce an HTML document (right?).

    So can the same be said for an email message? If email is sophisticated to send and html file properly formatted and presented as if it was being viewed in a browser, can it also to the same with an xml file?

    I imagine not. I would imagine that it could not pull off this trick. I imagine that the first order of business would be to use the xml and xsl files to produce the html file and then use that generated html file as the email.

    So what code or tools can be used to produce this html file?
     
  2. osnnraptor

    osnnraptor OSNN One Post Wonder

    Messages:
    6
    Re: Xml + xsl = html 4 email ??

    Probably you can not do this kind of things because most of the mail clients has very restricted browser (Outlook for example does not recognise al ot of css properties and some html tags) and due to security concerns I don;t think they will apply xsl to a xml.

    You may do some server side xml transformation to html for a letter.
     
  3. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Re: Xml + xsl = html 4 email ??

    You would need to use an XML/XSLT parser to create the final document to send over email. The browsers within email clients are very restricted and by default will not download extra content, nor will they automatically display content that is given to them.

    As for tools to do this? Well you have your standard browser. After the transformation is done you could save a copy of the file (I know this works in Safari), otherwise you may need to write custom sofware. There are plenty of libraries available that do XML parsing, and some even do XSLT.
     
  4. Complete

    Complete OSNN Addict

    Messages:
    94
    Re: Xml + xsl = html 4 email ??

    Here is a worthy, follow-up question.
    Does there exist a tool or a 3rd party program that can take an HTML file and split it up into an XML and XSL file that will effectively display the same thing in a browser than the original HTML file?
     
  5. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Re: Xml + xsl = html 4 email ??

    Yes, such a tool exists. It is called a human. He sits in front of a computer and creates the XML file that contains the data and the XSLT file that will do the translation.
     
  6. Gigabot

    Gigabot OSNN Senior Addict

    Messages:
    406
    Location:
    USA
    Re: Xml + xsl = html 4 email ??

    lol! I think he may have been talking about a tool that automates it. ;)
     
  7. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Re: Xml + xsl = html 4 email ??

    I am well aware. But how is the tool supposed to know what is valid content and what is markup? Taking two files to create one file is easy (XML + XSLT) but then taking that one file and splitting it back up into two is the hard part.