/[formed]/trunk/contrib/extract-xfa-items.sh
ViewVC logotype

Contents of /trunk/contrib/extract-xfa-items.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 40 - (show annotations)
Mon Aug 13 16:01:14 2007 UTC (17 years, 6 months ago) by teichmann
File MIME type: application/x-sh
File size: 1416 byte(s)
Added external loadable item list for choices.
1 #!/bin/sh
2 #
3 # (c) 2007 by Intevation GmbH
4 # Author: Sascha L. Teichmann
5 #
6 # A former and very handy feature of xsltproc (variables in matches)
7 # was removed as a bug (see http://bugzilla.gnome.org/show_bug.cgi?id=303289)
8 # Even if its more a shortcoming in the XPath specs this feature is gone.
9 #
10 # To allow variables in matches, we patch the transformation before
11 # execution. Ugly, but all other workarounds are a lot uglier ...
12 #
13
14 fieldname="'$1'"
15
16 (xsltproc - $2) <<EOF
17 <?xml version="1.0" encoding="UTF-8" ?>
18 <xsl:stylesheet version="1.0"
19 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20 xmlns:tmp="http://www.xfa.org/schema/xfa-template/2.5/"
21 xsl:exclude-result-prefixes="tmp">
22
23 <xsl:output method="xml" encoding="UTF-8"/>
24
25 <xsl:template match="tmp:field[@name = $fieldname]/tmp:items">
26 <choice>
27 <xsl:apply-templates/>
28 </choice>
29 </xsl:template>
30
31 <xsl:template match="tmp:field[@name = $fieldname]/tmp:items/tmp:text">
32 <bool>
33 <xsl:attribute name="value">
34 <xsl:value-of select="count(preceding-sibling::*)"/>
35 </xsl:attribute>
36 <xsl:attribute name="description">
37 <xsl:value-of select="."/>
38 </xsl:attribute>
39 </bool>
40 </xsl:template>
41
42 <xsl:template match="text()" />
43 <xsl:template match="/">
44 <document>
45 <xsl:apply-templates select="//tmp:field[@name = $fieldname]/tmp:items"/>
46 </document>
47 </xsl:template>
48
49 </xsl:stylesheet>
50 EOF

Properties

Name Value
svn:executable *

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26