-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathformtypes-xml.xsl
40 lines (35 loc) · 1.32 KB
/
formtypes-xml.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version='1.0' encoding='UTF-8'?>
<!-- stylesheet for FORM_TYPE registration -->
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:output method='xml' indent='yes'/>
<xsl:template match='/'>
<registry type='formtypes'>
<xsl:apply-templates select='/registry/form_type'/>
</registry>
</xsl:template>
<xsl:template match='form_type'>
<form_type>
<name><xsl:value-of select='name'/></name>
<desc><xsl:value-of select='desc'/></desc>
<doc><xsl:value-of select='doc'/></doc>
<xsl:apply-templates select='field'/>
</form_type>
</xsl:template>
<xsl:template match='field'>
<xsl:variable name='option.count' select='count(option)'/>
<field>
<xsl:attribute name='var'><xsl:value-of select='@var'/></xsl:attribute>
<xsl:attribute name='type'><xsl:value-of select='@type'/></xsl:attribute>
<xsl:attribute name='label'><xsl:value-of select='@label'/></xsl:attribute>
<xsl:if test='$option.count > 0'>
<xsl:apply-templates select='option'/>
</xsl:if>
</field>
</xsl:template>
<xsl:template match='option'>
<option>
<xsl:attribute name='label'><xsl:value-of select='@label'/></xsl:attribute>
<value><xsl:value-of select='value'/></value>
</option>
</xsl:template>
</xsl:stylesheet>