diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-22 17:50:30 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-22 18:21:41 +0200 |
commit | 980715d46755fb670fd7b57529fa498340910105 (patch) | |
tree | 09e979332b9b91b15d8e4c104dd05087205a00ab /sources/shiboken2/ApiExtractor/merge.xsl | |
parent | b68f2b96866c0422c2c02c9ca93874c0081d857b (diff) |
move everying into sources/shiboken2 (dev edition)
in preparation for a subtree merge.
this should not be necessary to do in a separate commit, but git is a
tad stupid about following history correctly without it.
Diffstat (limited to 'sources/shiboken2/ApiExtractor/merge.xsl')
-rw-r--r-- | sources/shiboken2/ApiExtractor/merge.xsl | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/merge.xsl b/sources/shiboken2/ApiExtractor/merge.xsl new file mode 100644 index 000000000..d0b7eafa5 --- /dev/null +++ b/sources/shiboken2/ApiExtractor/merge.xsl @@ -0,0 +1,82 @@ +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + <xsl:output method="xml" indent="yes"/> + <xsl:param name="lang" /> + <xsl:param name="source" /> + + <xsl:template match="processing-instruction()" /> + + <xsl:template match="/typesystem"> + <xsl:copy> + <xsl:for-each select="@*"> + <xsl:copy> + <xsl:value-of select="." /> + </xsl:copy> + </xsl:for-each> + + <xsl:for-each select="document($source)/typesystem/@*"> + <xsl:copy> + <xsl:value-of select="." /> + </xsl:copy> + </xsl:for-each> + + <xsl:variable name="other" select="document($source)/typesystem/*[not(self::object-type | self::value-type | self::interface-type | self::namespace-type)]" /> + <xsl:if test="$other"> + <xsl:choose> + <xsl:when test="$lang != ''"> + <xsl:element name="language"> + <xsl:attribute name="name" ><xsl:value-of select="$lang" /></xsl:attribute> + <xsl:copy-of select="$other" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$other" /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + + <xsl:apply-templates select="node()" /> + + </xsl:copy> + </xsl:template> + + + + <xsl:template match="/typesystem/*[self::object-type | self::value-type | self::interface-type | self::namespace-type]"> + <xsl:variable name="name" select="name()" /> + <xsl:copy> + <xsl:for-each select="@*"> + <xsl:copy> + <xsl:value-of select="." /> + </xsl:copy> + </xsl:for-each> + + <xsl:apply-templates select="node()" /> + + <xsl:variable name="other" select="document($source)/typesystem/*[name() = $name][@name = current()/@name]" /> + <xsl:if test="$other"> + <xsl:choose> + <xsl:when test="$lang != ''"> + <xsl:element name="language"> + <xsl:attribute name="name" ><xsl:value-of select="$lang" /></xsl:attribute> + <xsl:copy-of select="$other/node()" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$other/node()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:copy> + </xsl:template> + + <!-- Plain identity transform. --> + <xsl:template match="@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*"/> + <xsl:apply-templates select="node()"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> |