/usr/share/polymake/xml/upgrade-3.0.9.xslt is in polymake-common 3.2r2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | <?xml version="1.0"?>
<!--
Copyright (c) 1997-2018
Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
http://www.polymake.org
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version: http://www.gnu.org/licenses/gpl.txt.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
===============================================================================
-->
<xsl:transform version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:libxslt="http://xmlsoft.org/XSLT/namespace"
xmlns:p="http://www.math.tu-berlin.de/polymake/#3">
<xsl:output method="xml" encoding="utf-8" cdata-section-elements="p:description" indent="yes" />
<!-- tropical:
3.0.6:
Rename tropical::Cone to tropical::Polytope
Rename its properties CONE_COVECTOR_DECOMPOSITION, CONE_MAXIMAL_COVECTORS, CONE_MAXIMAL_COVECTOR_CELLS to POLYTOPE_...
-->
<!-- Rename properties of tropical cone -->
<xsl:template match="p:property[@name='CONE_MAXIMAL_COVECTORS']" mode="tropical">
<xsl:element name="property" namespace="{namespace-uri()}">
<xsl:attribute name="name">POLYTOPE_MAXIMAL_COVECTORS</xsl:attribute>
<xsl:apply-templates select="./node()" mode="tropical" />
</xsl:element>
</xsl:template>
<xsl:template match="p:property[@name='CONE_MAXIMAL_COVECTOR_CELLS']" mode="tropical">
<xsl:element name="property" namespace="{namespace-uri()}">
<xsl:attribute name="name">POLYTOPE_MAXIMAL_COVECTOR_CELLS</xsl:attribute>
<xsl:apply-templates select="./node()" mode="tropical" />
</xsl:element>
</xsl:template>
<xsl:template match="p:property[@name='CONE_COVECTOR_DECOMPOSITION']" mode="tropical">
<xsl:element name="property" namespace="{namespace-uri()}">
<xsl:attribute name="name">POLYTOPE_COVECTOR_DECOMPOSITION</xsl:attribute>
<xsl:apply-templates select="./node()" mode="tropical" />
</xsl:element>
</xsl:template>
<!-- Rename cone itself, but keep template parameter! -->
<xsl:template match="p:object[@type[contains(string(),'tropical::Cone')]]">
<xsl:element name="object" namespace="{namespace-uri()}">
<xsl:copy-of select="@*[name()!='type' and name()!='version']" />
<xsl:attribute name="type">
<xsl:value-of select="concat('tropical::Polytope<',substring-after(@type,'<'))"/>
</xsl:attribute>
<xsl:apply-templates select="./node()" mode="tropical" />
</xsl:element>
</xsl:template>
<!-- everything else is copied verbatim by switching back to the default mode -->
<xsl:template match="*" mode="tropical">
<xsl:apply-templates select="." />
</xsl:template>
<!-- matroids again:
3.0.7:
This corrects the faulty DIMS array in LATTICE_OF_FLATS: The last entry and any leading 0 are removed.
-->
<!-- Strips the last entry of the DIMS vector (but keeps the space before it) -->
<xsl:template name="stripLast">
<xsl:param name="pText"/>
<xsl:if test="contains($pText, ' ')">
<xsl:value-of select="concat(substring-before($pText, ' '),' ')"/>
<xsl:call-template name="stripLast">
<xsl:with-param name="pText" select=
"substring-after($pText, ' ')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="p:property[@name='LATTICE_OF_FLATS']/p:object/p:property[@name='DIMS']/p:v/text()">
<!-- First remove last entry using recursive template above -->
<xsl:variable name="strip_back">
<xsl:call-template name="stripLast">
<xsl:with-param name="pText" select="current()"/>
</xsl:call-template>
</xsl:variable>
<!-- Remove the trailing whitespace -->
<xsl:variable name="strip_and_trim">
<xsl:value-of select="substring($strip_back,0,string-length($strip_back))"/>
</xsl:variable>
<!-- Remove a leading 0 if it exists -->
<xsl:choose>
<xsl:when test="starts-with($strip_and_trim,'0 ')">
<xsl:value-of select="substring-after($strip_and_trim,'0 ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$strip_and_trim"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
3.0.7:
Rename FaceLattice to Lattice<BasicDecoration>
(with a slightly modified replace-object-type template
-->
<xsl:template match="p:*[@type[contains(string(),'FaceLattice')]]">
<xsl:call-template name="replace-object-type">
<xsl:with-param name="old_type">FaceLattice</xsl:with-param>
<xsl:with-param name="new_type">Lattice<BasicDecoration></xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Rename TightSpan to Polytope
3.0.8:
Rename TightSpan itself, but keep template parameter!
Move all additional properties into attachments. Need separate templates to specify type
-->
<!-- Rename TightSpan itself, but keep template parameter! -->
<xsl:template match="p:object[@type[contains(string(),'TightSpan')]]">
<xsl:element name="object" namespace="{namespace-uri()}">
<xsl:copy-of select="@*[name()!='type' and name()!='version']" />
<xsl:attribute name="type">
<xsl:value-of select="concat('polytope::Polytope<',substring-after(@type,'<'))"/>
</xsl:attribute>
<xsl:apply-templates select="./node()" mode="tightspan" />
</xsl:element>
</xsl:template>
<!-- Move all additional properties into attachments. Need separate templates to specify type -->
<xsl:template match="p:property[@name='METRIC']" mode="tightspan">
<xsl:element name="attachment" namespace="{namespace-uri()}">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="type">
<xsl:value-of select="concat('Matrix<',substring-after(../@type,'<'))"/>
</xsl:attribute>
<xsl:copy-of select="./node()" />
</xsl:element>
</xsl:template>
<xsl:template match="p:property[@name='COHERENT_SPLITS']" mode="tightspan">
<xsl:element name="attachment" namespace="{namespace-uri()}">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="type">Array<Pair<Set,Set>></xsl:attribute>
<xsl:copy-of select="./node()" />
</xsl:element>
</xsl:template>
<xsl:template match="p:property[@name='TAXA']" mode="tightspan">
<xsl:element name="attachment" namespace="{namespace-uri()}">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="type">Array<String></xsl:attribute>
<xsl:copy-of select="./node()" />
</xsl:element>
</xsl:template>
<xsl:template match="p:property[@name='VERTICES_IN_METRIC']" mode="tightspan">
<xsl:element name="attachment" namespace="{namespace-uri()}">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="type">Array<Int></xsl:attribute>
<xsl:copy-of select="./node()" />
</xsl:element>
</xsl:template>
<!-- everything else is copied verbatim by switching back to the default mode -->
<xsl:template match="*" mode="tightspan">
<xsl:apply-templates select="." />
</xsl:template>
<!-- rings / polynomials:
3.0.9:
Takes care of migration of old polynomials to new ones:
- Replace the tag describing the ring by a simple <e> tag containing the number of variables
- Remove property RING from Ideal
-->
<!-- Builds a node set of id-annotated <e> tags for each ring with an id -->
<xsl:variable name="ring_sizes">
<xsl:call-template name="calc_ring_sizes">
<xsl:with-param name="elems" select="//p:t[@id != '']" />
</xsl:call-template>
</xsl:variable>
<!-- For each ring definition, this creates an id-annotated <e> tag with the number of variables -->
<xsl:template name="calc_ring_sizes">
<xsl:param name="elems"/>
<xsl:for-each select="$elems">
<xsl:element name="e" namespace="{namespace-uri()}">
<xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute>
<xsl:call-template name="count_words">
<xsl:with-param name="str" select="normalize-space(./p:v)" />
</xsl:call-template>
</xsl:element>
</xsl:for-each>
</xsl:template>
<!-- Recursive template used to obtain the number of elements in a whitespace-separated list -->
<xsl:template name="count_words">
<xsl:param name="str"/>
<xsl:choose>
<xsl:when test="contains($str, ' ')">
<xsl:variable name="count_tail">
<xsl:call-template name="count_words">
<xsl:with-param name="str" select="substring-after($str, ' ')"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="1+$count_tail" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="1" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Builds the <e> node containing the number of variables -->
<xsl:template mode="fetch_ring_size" match="/">
<xsl:param name="ring_id" />
<xsl:for-each select="p:e[@id=$ring_id]">
<xsl:if test="text() != 1">
<xsl:element name="e" namespace="{namespace-uri()}">
<xsl:value-of select="text()" />
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- Match rings with given id, either the definition (<t>) or the backreference (<r>) -->
<xsl:template match="p:t/p:t[@id != ''] | p:r[@id != '']" priority="0.5">
<xsl:apply-templates mode="fetch_ring_size" select="libxslt:node-set($ring_sizes)">
<xsl:with-param name="ring_id" select="@id" />
</xsl:apply-templates>
</xsl:template>
<!-- Match ring with empty backreference (means there is only one ring in the file -->
<xsl:template match="p:r">
<xsl:apply-templates mode="fetch_ring_size" select="libxslt:node-set($ring_sizes)">
<xsl:with-param name="ring_id" select="1" />
</xsl:apply-templates>
</xsl:template>
<!-- Remove property RING from Ideal -->
<xsl:template match="p:object[@type='ideal::Ideal' or @type='Ideal']//p:property[@name='RING']"/>
<xsl:include href="trivial-copy.xslt" />
</xsl:transform>
|