1 <?xml version='
1.0'
encoding=
"UTF-8"?>
2 <!-- =====================================================================
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 Copyright 2008 by Sun Microsystems, Inc.
8 OpenOffice.org - a multi-platform office productivity suite
10 $RCSfile: oovbaconsts.xsl,v $
14 This file is part of OpenOffice.org.
16 OpenOffice.org is free software: you can redistribute it and/or modify
17 it under the terms of the GNU Lesser General Public License version 3
18 only, as published by the Free Software Foundation.
20 OpenOffice.org is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU Lesser General Public License version 3 for more details
24 (a copy is included in the LICENSE file that accompanied this code).
26 You should have received a copy of the GNU Lesser General Public License
27 version 3 along with OpenOffice.org. If not, see
28 <http://www.openoffice.org/license.html>
29 for a copy of the LGPLv3 License.
31 ====================================================================== -->
32 <xsl:stylesheet version=
"1.0"
33 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
34 xmlns:
redirect=
"http://xml.apache.org/xalan/redirect"
35 extension-element-prefixes=
"redirect">
36 <xsl:output method=
"text" indent=
"no" omit-xml-declaration=
"no" version=
"1.0" encoding=
"UTF-8" />
38 <!-- OPTIONAL: output directory for the IDL
39 Have to end with path separator -->
40 <xsl:param name=
"IDL_DIRECTORY" />
42 <xsl:key name=
"same-context-elements"
43 match=
"/api/element[@type='constant']"
44 use=
"normalize-space(source/context)" />
46 <xsl:template match=
"/">
47 <!-- once for each enumeration -->
48 <xsl:for-each select=
"/api/element[@type='enumeration']">
49 <xsl:sort select=
"normalize-space(source/name)" />
51 <redirect:write select=
"concat($IDL_DIRECTORY, normalize-space(source/name),'.idl')">
52 <xsl:call-template name=
"write-idl-prefix-1" />
53 <xsl:call-template name=
"write-idl-prefix-2" />
54 <!-- write IDL content -->
55 <xsl:for-each select=
"key('same-context-elements', normalize-space(source/name))">
56 <xsl:call-template name=
"write-idl-content" />
58 <xsl:call-template name=
"write-idl-suffix" />
64 <!-- writing the IDL prefix -->
65 <xsl:template name=
"write-idl-prefix-1">
66 <xsl:variable name=
"submod" select=
"source/@id"/>
67 <xsl:variable name=
"period" select=
"'.'"/>
68 <xsl:variable name=
"lcletters">abcdefghijklmnopqrstuvwxyz
</xsl:variable>
69 <xsl:variable name=
"ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ
</xsl:variable>
71 module org { module openoffice { module
</xsl:text><xsl:value-of select=
"translate(substring-before($submod,$period),$ucletters,$lcletters)"/>
73 <xsl:template name=
"write-idl-prefix-2">
75 constants
</xsl:text><xsl:value-of select=
"normalize-space(source/name)" /><xsl:text> {
</xsl:text>
78 <!-- writing the IDL content -->
79 <xsl:template name=
"write-idl-content">
81 const long
</xsl:text><xsl:value-of select=
"source/name" /><xsl:text> =
</xsl:text><xsl:value-of select=
"source/value" /><xsl:text>;
</xsl:text>
84 <!-- writing the IDL suffix -->
85 <xsl:template name=
"write-idl-suffix">