source: products/quintagroup.transmogrify.pfm2pfg/trunk/quintagroup/transmogrify/pfm2pfg/formmailer-formfolder.xsl @ 1498

Last change on this file since 1498 was 329, checked in by piv, 18 years ago

realise 0.2

File size: 2.8 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     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>
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                    <!-- skip 'cmf:workflow_history' element (PFG has another workflow) -->
22                    <xsl:when test="name()='cmf:workflow_history'" />
23                    <!-- copy all other elements -->
24                    <xsl:otherwise>
25                        <xsl:copy-of select="."/>
26                    </xsl:otherwise>
27                </xsl:choose>
28            </xsl:for-each>
29        </xsl:copy>
30    </xsl:for-each>
31</xsl:template>
32
33<xsl:template match="at:field">
34    <xsl:choose>
35        <!-- next fields are omitted -->
36        <xsl:when test="@name='before_script'" />
37        <xsl:when test="@name='form_buttons'" />
38
39        <!-- change field's name attribute from 'body' to 'text' -->
40        <xsl:when test="@name='form_pre'">
41            <xsl:copy>
42                <xsl:attribute name="name">formPrologue</xsl:attribute>
43                <xsl:value-of select="." />
44            </xsl:copy>
45        </xsl:when>
46        <!-- change field's name attribute from 'form_post' to 'text' -->
47        <xsl:when test="@name='form_post'">
48            <xsl:copy>
49                <xsl:attribute name="name">formEpilogue</xsl:attribute>
50                <xsl:value-of select="." />
51            </xsl:copy>
52        </xsl:when>
53        <xsl:when test="@name='sent_redirect'">
54            <xsl:copy>
55                <xsl:attribute name="name">thanksPageOverride</xsl:attribute>
56                <xsl:value-of select="." />
57            </xsl:copy>
58        </xsl:when>
59        <xsl:when test="@name='cpyaction'">
60            <xsl:copy>
61                <xsl:attribute name="name">afterValidationOverride</xsl:attribute>
62                <xsl:value-of select="." />
63            </xsl:copy>
64        </xsl:when>
65        <!-- copy all other elements -->
66        <xsl:otherwise>
67            <xsl:copy-of select="."/>
68        </xsl:otherwise>
69    </xsl:choose>
70</xsl:template>
71
72<xsl:template match="cmf:type">
73    <xsl:copy>
74        <xsl:text>FormFolder</xsl:text>
75    </xsl:copy>
76</xsl:template>
77
78</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.