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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 38 - (hide annotations)
Sun Aug 12 22:21:30 2007 UTC (17 years, 6 months ago) by teichmann
File MIME type: application/x-sh
File size: 1357 byte(s)
Added extractor for XFA choice item list
1 teichmann 38 #!/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     <items>
27     <xsl:apply-templates/>
28     </items>
29     </xsl:template>
30    
31     <xsl:template match="tmp:field[@name = $fieldname]/tmp:items/tmp:text">
32     <item>
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     </item>
40     </xsl:template>
41    
42     <xsl:template match="text()" />
43     <xsl:template match="/">
44     <xsl:apply-templates select="//tmp:field[@name = $fieldname]/tmp:items"/>
45     </xsl:template>
46    
47     </xsl:stylesheet>
48     EOF

Properties

Name Value
svn:executable *

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26