[293] | 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 | |
---|
| 7 | <xsl:template match="/"> |
---|
| 8 | <xsl:for-each select="*"> |
---|
| 9 | <!-- matched 'metadata' element and we copy it --> |
---|
| 10 | <xsl:copy select="."> |
---|
| 11 | <xsl:for-each select="*|text()"> |
---|
| 12 | <xsl:choose> |
---|
| 13 | <!-- do some special with 'field' elements --> |
---|
| 14 | <xsl:when test="name()='field'"> |
---|
| 15 | <xsl:apply-templates select="." /> |
---|
| 16 | </xsl:when> |
---|
| 17 | <!-- change value of 'cmf:type' attribute --> |
---|
| 18 | <xsl:when test="name()='cmf:type'"> |
---|
| 19 | <xsl:apply-templates select="." /> |
---|
| 20 | </xsl:when> |
---|
| 21 | <!-- do some special with 'cmf:workflow_history' element --> |
---|
| 22 | <xsl:when test="name()='cmf:workflow_history'"> |
---|
| 23 | <xsl:copy select="."> |
---|
| 24 | <xsl:apply-templates select="cmf:workflow" /> |
---|
| 25 | </xsl:copy> |
---|
| 26 | </xsl:when> |
---|
| 27 | <!-- copy all other elements --> |
---|
| 28 | <xsl:otherwise> |
---|
| 29 | <xsl:copy-of select="."/> |
---|
| 30 | </xsl:otherwise> |
---|
| 31 | </xsl:choose> |
---|
| 32 | </xsl:for-each> |
---|
| 33 | </xsl:copy> |
---|
| 34 | </xsl:for-each> |
---|
| 35 | </xsl:template> |
---|
| 36 | |
---|
| 37 | <xsl:template match="at:field"> |
---|
| 38 | <xsl:choose> |
---|
| 39 | <!-- next fields are omitted --> |
---|
| 40 | <xsl:when test="@name='alwaysOnTop'" /> |
---|
| 41 | <xsl:when test="@name='sendTrackBackURLs'" /> |
---|
| 42 | <!-- change field's name attribute from 'body' to 'text' --> |
---|
| 43 | <xsl:when test="@name='body'"> |
---|
| 44 | <xsl:copy select="."> |
---|
| 45 | <xsl:attribute name="name">text</xsl:attribute> |
---|
| 46 | <xsl:value-of select="." /> |
---|
| 47 | </xsl:copy> |
---|
| 48 | </xsl:when> |
---|
| 49 | <!-- change field's name attribute form 'categories' to 'subject' --> |
---|
| 50 | <xsl:when test="@name='categories'"> |
---|
| 51 | <dc:subject> |
---|
| 52 | <xsl:value-of select="."/> |
---|
| 53 | </dc:subject> |
---|
| 54 | </xsl:when> |
---|
| 55 | <!-- copy all other elements --> |
---|
| 56 | <xsl:otherwise> |
---|
| 57 | <xsl:copy-of select="."/> |
---|
| 58 | </xsl:otherwise> |
---|
| 59 | </xsl:choose> |
---|
| 60 | </xsl:template> |
---|
| 61 | |
---|
| 62 | <xsl:template match="cmf:type"> |
---|
| 63 | <xsl:copy select="."> |
---|
| 64 | <xsl:text>WeblogEntry</xsl:text> |
---|
| 65 | </xsl:copy> |
---|
| 66 | </xsl:template> |
---|
| 67 | |
---|
| 68 | <xsl:template match="cmf:workflow"> |
---|
| 69 | <xsl:copy select="."> |
---|
| 70 | <!-- rename 'id' attribute --> |
---|
| 71 | <xsl:attribute name="id">plone_workflow</xsl:attribute> |
---|
| 72 | <xsl:copy-of select="cmf:history"/> |
---|
| 73 | </xsl:copy> |
---|
| 74 | </xsl:template> |
---|
| 75 | |
---|
| 76 | </xsl:stylesheet> |
---|