/[formed]/trunk/contrib/convert-formedtree2csv.xsl
ViewVC logotype

Contents of /trunk/contrib/convert-formedtree2csv.xsl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (show annotations)
Wed Aug 15 15:47:47 2007 UTC (17 years, 6 months ago) by torsten
File MIME type: application/xml
File size: 1927 byte(s)
Added small xslt script for exporting the XML form-editor tree to CSV

1 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2 <!--
3 (c) 2007 by Intevation GmbH
4 Author: Torsten Irlaender
5 Converts the Formed xml tree into csv
6 -->
7 <xsl:output indent="yes" method="text" encoding="UTF-8"/>
8 <xsl:template match="*|/">
9 <xsl:apply-templates/>
10 </xsl:template>
11
12 <xsl:template match="group">
13 <xsl:text>### </xsl:text>
14 <xsl:value-of select="@description"/>
15 <xsl:text>&#xa;</xsl:text>
16 <xsl:apply-templates/>
17 </xsl:template>
18
19 <xsl:template match="switch">
20 <xsl:text>{</xsl:text>
21 <xsl:value-of select="local-name()"/>
22 <xsl:text>}</xsl:text>
23 <xsl:value-of select="@description"/>
24 <xsl:text>&#xa;</xsl:text>
25 <xsl:apply-templates/>
26 <xsl:text>{/</xsl:text>
27 <xsl:value-of select="local-name()"/>
28 <xsl:text>}</xsl:text>
29 <xsl:text>&#xa;</xsl:text>
30 </xsl:template>
31
32 <xsl:template match="radio|choice|checkbox">
33 <xsl:text>[</xsl:text>
34 <xsl:value-of select="local-name()"/>
35 <xsl:text>]</xsl:text>
36 <xsl:value-of select="@description"/>
37 <xsl:text>&#xa;</xsl:text>
38 <xsl:apply-templates/>
39 <xsl:text>[/</xsl:text>
40 <xsl:value-of select="local-name()"/>
41 <xsl:text>]</xsl:text>
42 <xsl:text>&#xa;</xsl:text>
43 </xsl:template>
44
45 <xsl:template match="text|textarea|int|date|bool">
46 <xsl:value-of select="@description"/>
47 <xsl:text>;</xsl:text>
48 <xsl:value-of select="local-name()"/>
49 <xsl:text>;</xsl:text>
50 <xsl:value-of select="@name"/>
51 <xsl:text>;</xsl:text>
52 <xsl:value-of select="@size"/>
53 <xsl:text>;</xsl:text>
54 <xsl:value-of select="@maxlength"/>
55 <xsl:text>;</xsl:text>
56 <xsl:value-of select="@minvalue"/>
57 <xsl:text>;</xsl:text>
58 <xsl:value-of select="@maxvalue"/>
59 <xsl:text>;</xsl:text>
60 <xsl:value-of select="@rows"/>
61 <xsl:text>;</xsl:text>
62 <xsl:value-of select="@cols"/>
63 <xsl:text>&#xa;</xsl:text>
64 </xsl:template>
65 <!-- suppress unneeded textual content -->
66 <xsl:template match="text()"/>
67 </xsl:stylesheet>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26