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 | |
---|
6 | <xsl:template match="/"> |
---|
7 | <xsl:for-each select="*"> |
---|
8 | <!-- matched 'metadata' element and we copy it --> |
---|
9 | <xsl:copy select="."> |
---|
10 | <xsl:for-each select="*|text()"> |
---|
11 | <xsl:choose> |
---|
12 | <!-- do some special with 'field' elements --> |
---|
13 | <xsl:when test="name()='field'"> |
---|
14 | <xsl:apply-templates select="." /> |
---|
15 | </xsl:when> |
---|
16 | <!-- change value of 'cmf:type' attribute --> |
---|
17 | <xsl:when test="name()='cmf:type'"> |
---|
18 | <xsl:apply-templates select="." /> |
---|
19 | </xsl:when> |
---|
20 | <!-- copy all other elements --> |
---|
21 | <xsl:otherwise> |
---|
22 | <xsl:copy-of select="."/> |
---|
23 | </xsl:otherwise> |
---|
24 | </xsl:choose> |
---|
25 | </xsl:for-each> |
---|
26 | </xsl:copy> |
---|
27 | </xsl:for-each> |
---|
28 | </xsl:template> |
---|
29 | |
---|
30 | <xsl:template match="at:field"> |
---|
31 | <xsl:choose> |
---|
32 | <!-- next fields are omitted --> |
---|
33 | <xsl:when test="@name='displayMode'" /> |
---|
34 | <xsl:when test="@name='displayItems'" /> |
---|
35 | <xsl:when test="@name='categories'" /> |
---|
36 | <xsl:when test="@name='allowTrackback'" /> |
---|
37 | <xsl:when test="@name='adminEmail'" /> |
---|
38 | <!-- copy all other elements --> |
---|
39 | <xsl:otherwise> |
---|
40 | <xsl:copy-of select="."/> |
---|
41 | </xsl:otherwise> |
---|
42 | </xsl:choose> |
---|
43 | </xsl:template> |
---|
44 | |
---|
45 | <xsl:template match="cmf:type"> |
---|
46 | <xsl:copy select="."> |
---|
47 | <xsl:text>Weblog</xsl:text> |
---|
48 | </xsl:copy> |
---|
49 | </xsl:template> |
---|
50 | |
---|
51 | </xsl:stylesheet> |
---|