Bump version to 4.1-6
[LibreOffice.git] / writerfilter / source / ooxml / attrsprm.xsl
blobf61a4c65aac539cda58c7b170a5ad3be863c26fe
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 -->
20 <xsl:stylesheet
21 version="1.0"
22 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23 xmlns:rng="http://relaxng.org/ns/structure/1.0"
24 xmlns:xalan="http://xml.apache.org/xalan"
25 exclude-result-prefixes = "xalan"
26 xml:indent="true">
27 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
29 <xsl:include href="factorytools.xsl"/>
31 <xsl:template match="/">
32 <class>
33 <xsl:for-each select="//rng:define[@name='CT_FFData']">
34 <xsl:call-template name="sprm"/>
35 <xsl:call-template name="attribute"/>
36 </xsl:for-each>
37 </class>
38 </xsl:template>
40 <xsl:template name="sprminner">
41 <xsl:variable name="defname" select="@name"/>
42 <xsl:for-each select=".//rng:ref[not(ancestor::rng:element or ancestor::rng:attribute)]">
43 <xsl:call-template name="sprminner"/>
44 </xsl:for-each>
45 <xsl:for-each select=".//rng:element">
46 <xsl:for-each select="rng:ref">
47 <xsl:variable name="refname" select="@name"/>
48 <xsl:for-each select="ancestor::namespace/rng:grammar/rng:define[@name=$refname]">
49 <xsl:call-template name="sprminner"/>
50 </xsl:for-each>
51 </xsl:for-each>
52 <element>
53 <xsl:variable name="elementname" select="@name"/>
54 <xsl:attribute name="name">
55 <xsl:value-of select="@name"/>
56 </xsl:attribute>
57 <xsl:for-each select="rng:ref">
58 <xsl:variable name="refname" select="@name"/>
59 <xsl:for-each select="ancestor::namespace/resource[@name=$refname]">
60 <xsl:attribute name="action">
61 <xsl:choose>
62 <xsl:when test="@resource='Properties'">
63 <xsl:text>resolve</xsl:text>
64 </xsl:when>
65 <xsl:otherwise>
66 <xsl:text>set</xsl:text>
67 </xsl:otherwise>
68 </xsl:choose>
69 </xsl:attribute>
70 </xsl:for-each>
71 <xsl:for-each select="ancestor::namespace/resource[@name=$defname]">
72 <xsl:for-each select="element[@name=$elementname]">
73 <xsl:attribute name="id">
74 <xsl:call-template name="idtoqname">
75 <xsl:with-param name="id">
76 <xsl:value-of select="@tokenid"/>
77 </xsl:with-param>
78 </xsl:call-template>
79 </xsl:attribute>
80 </xsl:for-each>
81 </xsl:for-each>
82 </xsl:for-each>
83 </element>
84 </xsl:for-each>
85 </xsl:template>
87 <xsl:template name="sprm">
88 <sprm>
89 <xsl:call-template name="sprminner"/>
90 </sprm>
91 </xsl:template>
93 <xsl:template name="attributeinner">
94 <xsl:param name="parent"/>
95 <xsl:for-each select=".//rng:ref[not(ancestor::rng:element or ancestor::rng:attribute)]">
96 <xsl:variable name="refname" select="@name"/>
97 <xsl:comment><xsl:value-of select="$newparent"/></xsl:comment>
98 <xsl:for-each select="ancestor::namespace/rng:grammar/rng:define[@name=$refname]">
99 <xsl:call-template name="attributeinner">
100 <xsl:with-param name="parent" select="$parent"/>
101 </xsl:call-template>
102 </xsl:for-each>
103 </xsl:for-each>
104 <xsl:for-each select=".//rng:element">
105 <xsl:variable name="newparent">
106 <xsl:if test="string-length($parent)">
107 <xsl:value-of select="$parent"/>
108 <xsl:text>:</xsl:text>
109 </xsl:if>
110 <xsl:value-of select="@name"/>
111 </xsl:variable>
112 <xsl:for-each select="rng:ref">
113 <xsl:variable name="refname" select="@name"/>
114 <xsl:for-each select="ancestor::namespace/rng:grammar/rng:define[@name=$refname]">
115 <xsl:call-template name="attributeinner">
116 <xsl:with-param name="parent" select="$newparent"/>
117 </xsl:call-template>
118 </xsl:for-each>
119 </xsl:for-each>
120 </xsl:for-each>
121 <xsl:variable name="defname" select="@name"/>
122 <xsl:variable name="resource">
123 <xsl:for-each select="ancestor::namespace/resource[@name=$defname]">
124 <xsl:value-of select="@resource"/>
125 </xsl:for-each>
126 </xsl:variable>
127 <xsl:if test="$resource='Properties'">
128 <xsl:for-each select=".//rng:attribute">
129 <xsl:variable name="attrname" select="@name"/>
130 <attribute>
131 <xsl:attribute name="name">
132 <xsl:if test="string-length($parent) > 0">
133 <xsl:value-of select="$parent"/>
134 <xsl:text>:</xsl:text>
135 </xsl:if>
136 <xsl:value-of select="$attrname"/>
137 </xsl:attribute>
138 <xsl:for-each select="ancestor::namespace/resource[@name=$defname]">
139 <xsl:for-each select="attribute[@name=$attrname]">
140 <xsl:attribute name="id">
141 <xsl:call-template name="idtoqname">
142 <xsl:with-param name="id">
143 <xsl:value-of select="@tokenid"/>
144 </xsl:with-param>
145 </xsl:call-template>
146 </xsl:attribute>
147 </xsl:for-each>
148 </xsl:for-each>
149 </attribute>
150 </xsl:for-each>
151 </xsl:if>
152 </xsl:template>
154 <xsl:template name="attribute">
155 <attribute>
156 <xsl:call-template name="attributeinner"/>
157 </attribute>
158 </xsl:template>
160 </xsl:stylesheet>