diff options
author | Jakob Sack <mail@jakobsack.de> | 2011-03-01 23:20:16 +0100 |
---|---|---|
committer | Jakob Sack <mail@jakobsack.de> | 2011-03-01 23:20:16 +0100 |
commit | 132695ceb1d7ab0e4bfbb141e9e9639111dd25b5 (patch) | |
tree | f53fabcefd89a1e5bbeda9a2c2d2fff6683139d4 /3dparty/Mail/xmail.xsl | |
parent | 1fd39a52fa750878e7d70fba63c099f252095762 (diff) | |
download | nextcloud-server-132695ceb1d7ab0e4bfbb141e9e9639111dd25b5.tar.gz nextcloud-server-132695ceb1d7ab0e4bfbb141e9e9639111dd25b5.zip |
Start of the refactoring. Commit is quite big because I forgot to use git right from the beginning. Sorry.
Diffstat (limited to '3dparty/Mail/xmail.xsl')
-rw-r--r-- | 3dparty/Mail/xmail.xsl | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/3dparty/Mail/xmail.xsl b/3dparty/Mail/xmail.xsl new file mode 100644 index 00000000000..0b948913f84 --- /dev/null +++ b/3dparty/Mail/xmail.xsl @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> +<xsl:output method="text" omit-xml-declaration="yes" indent="no"/> +<xsl:preserve-space elements="headervalue paramvalue body"/> + + <xsl:template name="mimepart"> + + <xsl:variable name="boundary"> + <xsl:for-each select="./header"> + <xsl:if test="string(./headername) = 'Content-Type'"> + <xsl:for-each select="./parameter"> + <xsl:if test="string(./paramname) = 'boundary'"> + <xsl:value-of select="paramvalue"/> + </xsl:if> + </xsl:for-each> + </xsl:if> + </xsl:for-each> + </xsl:variable> + + <xsl:for-each select="header"> + + <xsl:value-of select="headername"/> + <xsl:text>: </xsl:text> + <xsl:value-of select="headervalue"/> + + <xsl:if test="count(./parameter) = 0"> + <xsl:text> </xsl:text> + </xsl:if> + + <xsl:for-each select="parameter"> + <xsl:text>; 	</xsl:text> + <xsl:value-of select="paramname"/> + <xsl:text>="</xsl:text> + <xsl:value-of select="paramvalue"/> + <xsl:text>"</xsl:text> + </xsl:for-each> + + <xsl:if test="count(./parameter) > 0"> + <xsl:text> </xsl:text> + </xsl:if> + + </xsl:for-each> + + <xsl:text> </xsl:text> + + <!-- Which to do, print a body or process subparts? --> + <xsl:choose> + <xsl:when test="count(./mimepart) = 0"> + <xsl:value-of select="body"/> + <xsl:text> </xsl:text> + </xsl:when> + + <xsl:otherwise> + <xsl:for-each select="mimepart"> + <xsl:text>--</xsl:text><xsl:value-of select="$boundary"/><xsl:text> </xsl:text> + <xsl:call-template name="mimepart"/> + </xsl:for-each> + + <xsl:text>--</xsl:text><xsl:value-of select="$boundary"/><xsl:text>-- </xsl:text> + + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +<!-- This is where the stylesheet really starts, matching the top level email element --> + <xsl:template match="email"> + <xsl:call-template name="mimepart"/> + </xsl:template> + +</xsl:stylesheet>
\ No newline at end of file |