<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:sparql="http://www.w3.org/2005/sparql-results#">

<xsl:template match="/">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="*" priority="0">
    <xsl:copy select=".">
        <xsl:for-each select="@*">
            <xsl:attribute name="{name(.)}">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </xsl:for-each>
        <xsl:apply-templates/>
    </xsl:copy>
</xsl:template>

<xsl:template match="sparql:binding[sparql:unbound]" priority="4">
    <xsl:copy select=".">
        <xsl:for-each select="@*">
            <xsl:attribute name="{name(.)}">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </xsl:for-each>
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>

