--- /dev/null
+wdef_tools - Collection of tools to work with Wdef files.
+
+Repository: https://git.choffet.net/?p=wdef_tools.git
+
+
+These tools are designed to work on valid Wdef files (see this repository for
+more information: https://git.choffet.net/?p=wdef_schemas.git ). Behavior when
+applying on non-compliant file is undefined.
+
+Runtime dependencies are:
+ - Bash - https://www.gnu.org/software/bash/
+ Shell script interpreter
+
+ - Wikibase-cli - https://github.com/maxlath/wikibase-cli
+ Interface to Wikidata operations
+
+ - Xmlstarlet - http://xmlstar.sourceforge.net/
+ XSD and XSLT processor
+
+
+Description of the provided tools:
+ - xslts/canonicalize.xslt
+ Return a wdef under its normal form.
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- canonicalize.xslt - Rewrite a wdef file into its normal form.
+ Copyright (C) 2021 Pierre Choffet
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of version 3 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ -->
+<xsl:stylesheet version="1.0" xmlns:wdef="https://purl.choffet.net/wdef"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output indent="yes" method="xml" encoding="utf-8" />
+ <xsl:strip-space elements="*" />
+
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*" />
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- wdef:element with no child nodes -->
+ <xsl:template match="wdef:element[not(*)]" />
+
+ <!-- Local-only wdef:element with no label -->
+ <xsl:template match="wdef:element[substring(@wdef:id, 1, 1) != 'Q' and not(wdef:label)]" />
+
+ <!-- wdef:property with no child nodes -->
+ <xsl:template match="wdef:property[not(*)]" />
+
+ <!-- wdef:value or wdef:novalue with no temporary @wdef:value and no qualifier -->
+ <xsl:template match="wdef:value[substring(@wdef:id, 1, 1) != '?' and not(wdef:qualifier)]" />
+ <xsl:template match="wdef:novalue[substring(@wdef:id, 1, 1) != '?' and not(wdef:qualifier)]" />
+
+ <!-- wdef:qualifier with no wdef:value having temporary @wdef:id -->
+ <xsl:template match="wdef:qualifier[wdef:property/wdef:value[substring(@wdef:id, 1, 1) != '?']]" />
+</xsl:stylesheet>