-
Notifications
You must be signed in to change notification settings - Fork 0
/
migration-fichiers-parametre.xsl
52 lines (47 loc) · 1.93 KB
/
migration-fichiers-parametre.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
41
42
43
44
45
46
47
48
49
50
51
52
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="2.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
<Parameters>
<Title>
<Sequence>
<xsl:apply-templates select="//sequence/*"/>
</Sequence>
<Question>
<xsl:apply-templates select="//question/*"/>
</Question>
</Title>
</Parameters>
</xsl:template>
<xsl:template match="niveau" priority="2">
<Level>
<xsl:variable name="valeur">
<xsl:choose>
<xsl:when test="@nom='Modele'">
<xsl:value-of select="string('template')"/>
</xsl:when>
<xsl:when test="@nom='Module'">
<xsl:value-of select="string('module')"/>
</xsl:when>
<xsl:when test="@nom='Paragraphe'">
<xsl:value-of select="string('submodule')"/>
</xsl:when>
<xsl:when test="@nom='Groupe'">
<xsl:value-of select="string('group')"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="name" select="$valeur">
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</Level>
</xsl:template>
<xsl:template match="*">
<xsl:variable name="premierCaractere">
<xsl:value-of select="upper-case(substring(name(),1,1))"/>
</xsl:variable>
<xsl:element name="{concat($premierCaractere, substring(name(),2))}">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>
</xsl:transform>