</template>
        <template match="*" mode="Vocab:render-value">
                <param name="root" select="/"/>
+               <variable name="datatype" select="@rdf:datatype"/>
                <element name="code" namespace="&xhtml;">
                        <text>"</text>
                        <element name="span" namespace="&xhtml;">
                                        <text>@</text>
                                        <value-of select="@xml:lang"/>
                                </when>
-                               <when test="@rdf:datatype and string(@rdf:datatype)!='http://www.w3.org/2001/XMLSchema#string'">
+                               <when test="$datatype and string($datatype)!='http://www.w3.org/2001/XMLSchema#string'">
                                        <text>^^</text>
-                                       <for-each select="/">
+                                       <for-each select="$root">
                                                <call-template name="Vocab:link-to">
-                                                       <with-param name="resource" select="@rdf:datatype"/>
+                                                       <with-param name="resource" select="string($datatype)"/>
                                                        <with-param name="kind" select="'class'"/>
                                                </call-template>
                                        </for-each>