[320] | 1 | <xsl:stylesheet version="1.0" |
---|
| 2 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
| 3 | xmlns:at="http://plone.org/ns/archetypes/" |
---|
| 4 | xmlns:cmf="http://cmf.zope.org/namespaces/default/" |
---|
| 5 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
| 6 | xmlns:xmp="adobe:ns:meta"> |
---|
| 7 | |
---|
| 8 | <xsl:template match="/"> |
---|
| 9 | <xsl:for-each select="*"> |
---|
| 10 | <!-- matched 'metadata' element and we copy it --> |
---|
[329] | 11 | <xsl:copy> |
---|
[320] | 12 | <xsl:for-each select="*|text()"> |
---|
| 13 | <xsl:choose> |
---|
| 14 | <!-- do some special with 'field' elements --> |
---|
| 15 | <xsl:when test="name()='field'"> |
---|
| 16 | <xsl:apply-templates select="." /> |
---|
| 17 | </xsl:when> |
---|
| 18 | <!-- remove unnecessary elements --> |
---|
| 19 | <xsl:when test="name()='form'" /> |
---|
| 20 | <xsl:when test="name()='uid'" /> |
---|
| 21 | <xsl:when test="name()='dc:title'" /> |
---|
| 22 | <xsl:when test="name()='dc:description'" /> |
---|
| 23 | <xsl:when test="name()='dc:contributor'" /> |
---|
| 24 | <xsl:when test="name()='dc:creator'" /> |
---|
| 25 | <xsl:when test="name()='dc:rights'" /> |
---|
| 26 | <xsl:when test="name()='dc:language'" /> |
---|
[323] | 27 | <!--xsl:when test="name()='xmp:CreateDate'" /--> |
---|
| 28 | <!-- xsl:when test="name()='xmp:ModifyDate'" /--> |
---|
[320] | 29 | <xsl:when test="name()='cmf:type'" /> |
---|
| 30 | <xsl:when test="name()='cmf:workflow_history'" /> |
---|
| 31 | <xsl:when test="name()='cmf:security'" /> |
---|
| 32 | <!-- copy all other elements --> |
---|
| 33 | <xsl:otherwise> |
---|
| 34 | <xsl:copy-of select="."/> |
---|
| 35 | </xsl:otherwise> |
---|
| 36 | </xsl:choose> |
---|
| 37 | </xsl:for-each> |
---|
| 38 | </xsl:copy> |
---|
| 39 | </xsl:for-each> |
---|
| 40 | </xsl:template> |
---|
| 41 | |
---|
| 42 | <xsl:template match="at:field"> |
---|
| 43 | <xsl:choose> |
---|
| 44 | <!-- next at fields are omitted --> |
---|
| 45 | <xsl:when test="@name='id'" /> |
---|
| 46 | <xsl:when test="@name='relatedItems'" /> |
---|
| 47 | <xsl:when test="@name='location'" /> |
---|
| 48 | <xsl:when test="@name='effectiveDate'" /> |
---|
| 49 | <xsl:when test="@name='expirationDate'" /> |
---|
| 50 | <xsl:when test="@name='allowDiscussion'" /> |
---|
| 51 | <xsl:when test="@name='excludeFromNav'" /> |
---|
| 52 | <!-- skip zpt of message body, because it can't be used in PFG --> |
---|
| 53 | <xsl:when test="@name='body_pt'" /> |
---|
| 54 | |
---|
| 55 | <!-- change field's name attribute from 'recipient_email' to 'recipientOverride' (TALESString) --> |
---|
| 56 | <xsl:when test="@name='recipient_email'"> |
---|
[329] | 57 | <xsl:copy> |
---|
[320] | 58 | <xsl:attribute name="name">recipientOverride</xsl:attribute> |
---|
| 59 | <xsl:value-of select="." /> |
---|
| 60 | </xsl:copy> |
---|
| 61 | </xsl:when> |
---|
| 62 | <!-- change field's name attribute from 'subject' to 'subjectOverride' (TALESString) --> |
---|
| 63 | <xsl:when test="@name='subject'"> |
---|
[329] | 64 | <xsl:copy> |
---|
[320] | 65 | <xsl:attribute name="name">subjectOverride</xsl:attribute> |
---|
| 66 | <xsl:value-of select="." /> |
---|
| 67 | </xsl:copy> |
---|
| 68 | </xsl:when> |
---|
| 69 | |
---|
| 70 | <xsl:when test="@name='body_type'"> |
---|
[329] | 71 | <xsl:copy> |
---|
[320] | 72 | <xsl:attribute name="name">body_type</xsl:attribute> |
---|
| 73 | <xsl:choose> |
---|
| 74 | <xsl:when test="contains(string(), 'text/plain')"> |
---|
| 75 | <xsl:text>plain</xsl:text> |
---|
| 76 | </xsl:when> |
---|
| 77 | <xsl:when test="contains(string(), 'text/html')"> |
---|
| 78 | <xsl:text>html</xsl:text> |
---|
| 79 | </xsl:when> |
---|
| 80 | <xsl:otherwise> |
---|
| 81 | <xsl:text>plain</xsl:text> |
---|
| 82 | </xsl:otherwise> |
---|
| 83 | </xsl:choose> |
---|
| 84 | </xsl:copy> |
---|
| 85 | </xsl:when> |
---|
| 86 | |
---|
| 87 | <!-- copy all other elements --> |
---|
| 88 | <xsl:otherwise> |
---|
| 89 | <xsl:copy-of select="."/> |
---|
| 90 | </xsl:otherwise> |
---|
| 91 | </xsl:choose> |
---|
| 92 | </xsl:template> |
---|
| 93 | |
---|
| 94 | </xsl:stylesheet> |
---|