/[formed]/trunk/contrib/extract-xfa-fields_and_options.xsl
ViewVC logotype

Contents of /trunk/contrib/extract-xfa-fields_and_options.xsl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 80 - (show annotations)
Thu Aug 23 09:49:22 2007 UTC (17 years, 6 months ago) by torsten
File MIME type: application/xml
File size: 3932 byte(s)
Added small script to extract fields and options from the formlar XFA data.

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tmp="http://www.xfa.org/schema/xfa-template/2.5/" xmlns:tmpl="http://www.xfa.org/schema/xfa-form/2.6/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:str="http://exslt.org/strings" version="1.0" xsl:exclude-result-prefixes="tmp">
3 -->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tmp="http://www.xfa.org/schema/xfa-template/2.5/" xmlns:tmpl="http://www.xfa.org/schema/xfa-form/2.6/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:str="http://exslt.org/strings" version="1.0">
5 <xsl:import href="str.replace.template.xsl"/>
6 <xsl:variable name="lcase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
7 <xsl:variable name="ucase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
8 <xsl:output indent="yes" method="xml" encoding="UTF-8"/>
9 <xsl:template name="umlaute">
10 <xsl:param name="utf8string"/>
11 <xsl:variable name="translated_ae">
12 <xsl:call-template name="str:replace">
13 <xsl:with-param name="string" select="$utf8string"/>
14 <xsl:with-param name="search">ä</xsl:with-param>
15 <xsl:with-param name="replace">ae</xsl:with-param>
16 </xsl:call-template>
17 </xsl:variable>
18 <xsl:variable name="translated_oe">
19 <xsl:call-template name="str:replace">
20 <xsl:with-param name="string" select="$translated_ae"/>
21 <xsl:with-param name="search">ö</xsl:with-param>
22 <xsl:with-param name="replace">oe</xsl:with-param>
23 </xsl:call-template>
24 </xsl:variable>
25 <xsl:variable name="translated_ue">
26 <xsl:call-template name="str:replace">
27 <xsl:with-param name="string" select="$translated_oe"/>
28 <xsl:with-param name="search">ü</xsl:with-param>
29 <xsl:with-param name="replace">ue</xsl:with-param>
30 </xsl:call-template>
31 </xsl:variable>
32 <xsl:call-template name="str:replace">
33 <xsl:with-param name="string" select="$translated_ue"/>
34 <xsl:with-param name="search">ß</xsl:with-param>
35 <xsl:with-param name="replace">ss</xsl:with-param>
36 </xsl:call-template>
37 </xsl:template>
38
39
40
41 <xsl:template name="get_options">
42 <xsl:param name="fieldname"/>
43 <test>
44 <xsl:value-of select="//tmp:field[@name=$fieldname]"/>
45 </test>
46 </xsl:template>
47
48
49
50 <!-- For version 1.0
51 <xsl:template match="Formular1/*">
52 -->
53 <xsl:template match="Case_Management/*">
54 <Seite>
55 <xsl:variable name="translated">
56 <xsl:call-template name="umlaute">
57 <xsl:with-param name="utf8string" select="translate(local-name(),$ucase,$lcase)"/>
58 </xsl:call-template>
59 </xsl:variable>
60 <xsl:attribute name="name">
61 <!--<xsl:value-of
62 select="str:replace(translate(local-name(),$ucase,$lcase),'ä','ae')"/>-->
63 <xsl:value-of select="$translated"/>
64 </xsl:attribute>
65 <xsl:apply-templates/>
66 </Seite>
67 </xsl:template>
68 <xsl:template match="*">
69 <Item>
70 <xsl:variable name="untranslated" select="local-name()"/>
71 <xsl:variable name="translated">
72 <xsl:call-template name="umlaute">
73 <xsl:with-param name="utf8string" select="translate(local-name(),$ucase,$lcase)"/>
74 </xsl:call-template>
75 </xsl:variable>
76 <xsl:attribute name="name">
77 <!--<xsl:value-of
78 select="str:replace(translate(local-name(),$ucase,$lcase),'ä','ae')"/>-->
79 <xsl:value-of select="$translated"/>
80 </xsl:attribute>
81 <xsl:call-template name="get_options">
82 <xsl:with-param name="fieldname" select="$untranslated"/>
83 </xsl:call-template>
84 <xsl:apply-templates/>
85 </Item>
86 </xsl:template>
87 <xsl:template match="text()"/>
88 <xsl:template match="/">
89 <Formular>
90 <!-- For version 1.0
91 <xsl:apply-templates select="//Formular1/*"/>
92 -->
93 <xsl:apply-templates select="//Case_Management/*"/>
94 </Formular>
95 </xsl:template>
96 </xsl:stylesheet>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26