merge the formfield patch from ooo-build
[ooovba.git] / writerfilter / source / doctok / WW8inc.xsl
blob9d860dcc7db223197a6ef1c85db378dd8a73eee4
1 /*************************************************************************
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 Copyright 2008 by Sun Microsystems, Inc.
7 OpenOffice.org - a multi-platform office productivity suite
9 $RCSfile: WW8inc.xsl,v $
11 $Revision: 1.4 $
13 This file is part of OpenOffice.org.
15 OpenOffice.org is free software: you can redistribute it and/or modify
16 it under the terms of the GNU Lesser General Public License version 3
17 only, as published by the Free Software Foundation.
19 OpenOffice.org is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Lesser General Public License version 3 for more details
23 (a copy is included in the LICENSE file that accompanied this code).
25 You should have received a copy of the GNU Lesser General Public License
26 version 3 along with OpenOffice.org. If not, see
27 <http://www.openoffice.org/license.html>
28 for a copy of the LGPLv3 License.
30 ************************************************************************/
32 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
33 <xsl:output method="text" encoding="iso-8859-1"/>
35 <xsl:template match="/">
36 <xsl:apply-templates select="//xhtml:body/xhtml:table"/>
37 </xsl:template>
39 <xsl:template match="xhtml:table">
40 <xsl:apply-templates select="xhtml:tbody/xhtml:tr[2]"/>
41 </xsl:template>
43 <xsl:template name="handleTR">
44 <xsl:param name="offset"/>
45 <xsl:param name="shift"/>
46 <xsl:variable name="name"><xsl:value-of select="xhtml:td[3]"/></xsl:variable>
47 <xsl:variable name="type"><xsl:value-of select="xhtml:td[4]"/></xsl:variable>
48 <xsl:variable name="saltype">
49 <xsl:choose>
50 <xsl:when test="$type='U8'">sal_uInt8</xsl:when>
51 <xsl:when test="$type='S8'">sal_Int8</xsl:when>
52 <xsl:when test="$type='U16'">sal_uInt16</xsl:when>
53 <xsl:when test="$type='S16'">sal_Int16</xsl:when>
54 <xsl:when test="$type='U32'">sal_uInt32</xsl:when>
55 <xsl:when test="$type='S32'">sal_Int32</xsl:when>
56 <xsl:otherwise>void *</xsl:otherwise>
57 </xsl:choose>
58 </xsl:variable>
59 <xsl:variable name="bits"><xsl:value-of select="xhtml:td[5]"/></xsl:variable>
60 <xsl:variable name="mask"><xsl:value-of select="xhtml:td[6]"/></xsl:variable>
61 <xsl:variable name="comment"><xsl:value-of select="xhtml:td[7]"/></xsl:variable>
62 /**
63 <xsl:value-of select="$comment"/>
65 offset : <xsl:value-of select="$offset"/>
66 name : <xsl:value-of select="$name"/>
67 type : <xsl:value-of select="$type"/>
68 shift : <xsl:value-of select="concat($shift, '&#xa;')"/>
71 <xsl:value-of select="$saltype"/> get_<xsl:value-of select="$name"/>() const<xsl:choose>
72 <xsl:when test="$saltype='void *'">;
73 </xsl:when>
74 <xsl:otherwise> { return (get<xsl:value-of select="$type"/>(0x<xsl:value-of select="$offset"/>)<xsl:if test="string-length($mask)>0"> &amp; 0x<xsl:value-of select="translate($mask, 'ABCDEF', 'abcdef')"/></xsl:if>)<xsl:if test="$shift>0"> &gt;&gt; <xsl:value-of select="$shift"/></xsl:if>; }
75 </xsl:otherwise>
76 </xsl:choose>
77 </xsl:template>
79 <xsl:template match="xhtml:tr[./xhtml:td[position()=1]/text()]">
80 <xsl:variable name="offset"><xsl:value-of select="xhtml:td[2]"/></xsl:variable>
81 <xsl:call-template name="handleTR">
82 <xsl:with-param name="offset" select="$offset"/>
83 <xsl:with-param name="shift">0</xsl:with-param>
84 </xsl:call-template>
85 <xsl:variable name="shift1"><xsl:value-of select="substring-after(xhtml:td[5], ':')"/></xsl:variable>
86 <xsl:apply-templates select="following-sibling::xhtml:tr[position()=1]">
87 <xsl:with-param name="offset" select="$offset"/>
88 <xsl:with-param name="shift" select="$shift1"/>
89 </xsl:apply-templates>
90 </xsl:template>
92 <xsl:template match="xhtml:tr[not(./xhtml:td[position()=1]/text())]">
93 <xsl:param name="offset"/>
94 <xsl:param name="shift"/>
95 <xsl:call-template name="handleTR">
96 <xsl:with-param name="offset" select="$offset"/>
97 <xsl:with-param name="shift" select="$shift"/>
98 </xsl:call-template>
99 <xsl:variable name="shift1"><xsl:value-of select="$shift+substring-after(xhtml:td[5], ':')"/></xsl:variable>
100 <xsl:apply-templates select="following-sibling::xhtml:tr[position()=1]">
101 <xsl:with-param name="offset" select="$offset"/>
102 <xsl:with-param name="shift" select="$shift1"/>
103 </xsl:apply-templates>
104 </xsl:template>
106 <xsl:template match="*">
107 <xsl:copy-of select="."/>
108 </xsl:template>
110 </xsl:stylesheet>