source: products/quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/blog-largefolder.xsl @ 1244

Last change on this file since 1244 was 612, checked in by crchemist, 17 years ago

reverting erroneous commit [368] (svn merge -r 368:367 http://svn/products/qPloneComments/tags/2.0)

File size: 3.4 KB
Line 
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                    <!-- do some special with 'cmf:workflow_history' element -->
21                    <xsl:when test="name()='cmf:workflow_history'">
22                        <xsl:copy select=".">
23                            <xsl:apply-templates select="cmf:workflow" />
24                        </xsl:copy>
25                    </xsl:when>
26                    <!-- copy all other elements -->
27                    <xsl:otherwise>
28                        <xsl:copy-of select="."/>
29                    </xsl:otherwise>
30                </xsl:choose>
31            </xsl:for-each>
32        </xsl:copy>
33    </xsl:for-each>
34</xsl:template>
35
36<xsl:template match="at:field">
37    <xsl:choose>
38        <!-- next fields are omitted -->
39        <xsl:when test="@name='displayMode'" />
40        <xsl:when test="@name='displayItems'" />
41        <xsl:when test="@name='categories'" />
42        <xsl:when test="@name='allowTrackback'" />
43        <xsl:when test="@name='adminEmail'" />
44        <!-- copy all other elements -->
45        <xsl:otherwise>
46            <xsl:copy-of select="."/>
47        </xsl:otherwise>
48    </xsl:choose>
49</xsl:template>
50
51<xsl:template match="cmf:type">
52    <xsl:copy select=".">
53        <xsl:text>Large Plone Folder</xsl:text>
54    </xsl:copy>
55</xsl:template>
56
57<xsl:template match="cmf:workflow">
58    <xsl:copy select=".">
59        <!-- rename 'id' attribute -->
60        <xsl:attribute name="id">simple_publication_workflow</xsl:attribute>
61        <xsl:for-each select="*|text()">
62            <xsl:choose>
63                <!-- do some special with 'cmf:workflow_history' element -->
64                <xsl:when test="name()='cmf:history'">
65                    <xsl:copy select=".">
66                        <xsl:apply-templates select="cmf:var" />
67                    </xsl:copy>
68                </xsl:when>
69                <!-- copy all other elements -->
70                <xsl:otherwise>
71                    <xsl:copy-of select="."/>
72                </xsl:otherwise>
73            </xsl:choose>
74        </xsl:for-each>
75    </xsl:copy>
76</xsl:template>
77
78<xsl:template match="cmf:var">
79    <xsl:choose>
80        <xsl:when test="@value='visible'">
81            <xsl:copy select=".">
82                <xsl:attribute name="id">review_state</xsl:attribute>
83                <xsl:attribute name="type">str</xsl:attribute>
84                <xsl:attribute name="value">published</xsl:attribute>
85                <xsl:value-of select="." />
86            </xsl:copy>
87        </xsl:when>
88        <!-- copy all other elements -->
89        <xsl:otherwise>
90            <xsl:copy-of select="."/>
91        </xsl:otherwise>
92    </xsl:choose>
93</xsl:template>
94
95</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.