source: products/quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/blogfolder-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.3 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='existingCats'" />
40        <xsl:when test="@name='categories'" />
41        <!-- copy all other elements -->
42        <xsl:otherwise>
43            <xsl:copy-of select="."/>
44        </xsl:otherwise>
45    </xsl:choose>
46</xsl:template>
47
48<xsl:template match="cmf:type">
49    <xsl:copy select=".">
50        <xsl:text>Large Plone Folder</xsl:text>
51    </xsl:copy>
52</xsl:template>
53
54<xsl:template match="cmf:workflow">
55    <xsl:copy select=".">
56        <!-- rename 'id' attribute -->
57        <xsl:attribute name="id">simple_publication_workflow</xsl:attribute>
58        <xsl:for-each select="*|text()">
59            <xsl:choose>
60                <!-- do some special with 'cmf:workflow_history' element -->
61                <xsl:when test="name()='cmf:history'">
62                    <xsl:copy select=".">
63                        <xsl:apply-templates select="cmf:var" />
64                    </xsl:copy>
65                </xsl:when>
66                <!-- copy all other elements -->
67                <xsl:otherwise>
68                    <xsl:copy-of select="."/>
69                </xsl:otherwise>
70            </xsl:choose>
71        </xsl:for-each>
72    </xsl:copy>
73</xsl:template>
74
75<xsl:template match="cmf:var">
76    <xsl:choose>
77        <xsl:when test="@value='visible'">
78            <xsl:copy select=".">
79                <xsl:attribute name="id">review_state</xsl:attribute>
80                <xsl:attribute name="type">str</xsl:attribute>
81                <xsl:attribute name="value">published</xsl:attribute>
82                <xsl:value-of select="." />
83            </xsl:copy>
84        </xsl:when>
85        <!-- copy all other elements -->
86        <xsl:otherwise>
87            <xsl:copy-of select="."/>
88        </xsl:otherwise>
89    </xsl:choose>
90</xsl:template>
91
92</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.