diff --git a/src/core/xsl/query.xsl b/src/core/xsl/query.xsl
index e0fa224dcaa16bb2c2b516b77f8ddb8d2075ad9f..926bf907d34aad63cedd25097c800611b07e39c7 100644
--- a/src/core/xsl/query.xsl
+++ b/src/core/xsl/query.xsl
@@ -225,15 +225,28 @@
         <xsl:value-of select="$field-name"/>
       </xsl:attribute>
       <div class="caosdb-f-property-value caosdb-v-property-value">
-        <xsl:apply-templates select="/Response/*[@id=$entity-id and Version/@id=$version-id]" mode="walk-select-segments">
-        <!--<xsl:apply-templates select="/Response/*[@id=$entity-id]" mode="walk-select-segments">-->
-          <xsl:with-param name="first-segment">
-            <xsl:value-of select="substring-before(concat($field-name, '.'), '.')"/>
-          </xsl:with-param>
-          <xsl:with-param name="next-segments">
-            <xsl:value-of select="substring-after($field-name, '.')"/>
-          </xsl:with-param>
-        </xsl:apply-templates>
+        <xsl:choose>
+          <xsl:when test="$version-id!=''">
+            <xsl:apply-templates select="/Response/*[@id=$entity-id and Version/@id=$version-id]" mode="walk-select-segments">
+              <xsl:with-param name="first-segment">
+                <xsl:value-of select="substring-before(concat($field-name, '.'), '.')"/>
+              </xsl:with-param>
+              <xsl:with-param name="next-segments">
+                <xsl:value-of select="substring-after($field-name, '.')"/>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="/Response/*[@id=$entity-id]" mode="walk-select-segments">
+              <xsl:with-param name="first-segment">
+                <xsl:value-of select="substring-before(concat($field-name, '.'), '.')"/>
+              </xsl:with-param>
+              <xsl:with-param name="next-segments">
+                <xsl:value-of select="substring-after($field-name, '.')"/>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:otherwise>
+        </xsl:choose>
       </div>
     </td>
   </xsl:template>
diff --git a/test/core/js/modules/entity.xsl.js b/test/core/js/modules/entity.xsl.js
index bbc1cac0c7eff6bb06c6826c6efb7054827e82c3..e5ff1e8700b8349cddbdda0a0b52ffef47e4e75f 100644
--- a/test/core/js/modules/entity.xsl.js
+++ b/test/core/js/modules/entity.xsl.js
@@ -317,7 +317,7 @@ function applyTemplates(xml, xsl, mode, select = "*") {
     return xslt(xml, modXsl);
 }
 
-function callTemplate(xsl, template, params, wrap_call) {
+function callTemplate(xsl, template, params, wrap_call, root) {
     let entryRuleStart = '<xsl:call-template name="' + template + '">';
     let entryRuleEnd = '</xsl:call-template>';
     var entryRule = entryRuleStart;
@@ -331,5 +331,6 @@ function callTemplate(xsl, template, params, wrap_call) {
     entryRule = '<xsl:template xmlns="http://www.w3.org/1999/xhtml" priority="9" match="/">' +
         entryRule + '</xsl:template>';
     let modXsl = injectTemplate(xsl, entryRule);
-    return xslt(str2xml('<root/>'), modXsl);
+    root = root || '<root/>';
+    return xslt(str2xml(root), modXsl);
 }
diff --git a/test/core/js/modules/query.xsl.js b/test/core/js/modules/query.xsl.js
index 371b51598918e2fd6bb5d94ca13a94337ccd322e..e644a674b6a8e58fd7c1395d1e337d5416c2bc5e 100644
--- a/test/core/js/modules/query.xsl.js
+++ b/test/core/js/modules/query.xsl.js
@@ -28,19 +28,25 @@ QUnit.module("query.xsl", {
         // load query.xsl
         var done = assert.async();
         var qunit_obj = this;
-        $.ajax({
-            cache: true,
-            dataType: 'xml',
-            url: "xsl/query.xsl",
-        }).done(function(data, textStatus, jdXHR) {
-            insertParam(data, "entitypath", "/entitypath/");
-            qunit_obj.queryXSL = data;
-        }).always(function() {
+        _retrieveQueryXSL().then(function(xsl) {
+            qunit_obj.queryXSL = xsl;
             done();
         });
     }
 });
 
+async function _retrieveQueryXSL() {
+    var queryXsl = await transformation.retrieveXsltScript("query.xsl");
+    var entityXsl = await transformation.retrieveXsltScript("entity.xsl");
+    var commonXsl = await transformation.retrieveXsltScript("common.xsl");
+    var xsl = transformation.mergeXsltScripts(entityXsl, [commonXsl, queryXsl]);
+    insertParam(xsl, "entitypath", "/entitypath/");
+    insertParam(xsl, "filesystempath", "/filesystempath/");
+    insertParam(xsl, "lowercase", "abcdefghijklmnopqrstuvwxyz");
+    insertParam(xsl, "uppercase", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+    return xsl;
+}
+
 /* TESTS */
 QUnit.test("availability", function(assert) {
     assert.ok(this.queryXSL);
@@ -183,6 +189,35 @@ QUnit.test("template select-table-row ", function(assert){
     assert.equal(next.tagName, "A", "tagName = A");
 });
 
+QUnit.test("template select-table-cell (with version) ", function(assert){
+  let cell = callTemplate(this.queryXSL, "select-table-cell", {"version-id": "vid-2345", "entity-id": "eid-1234", "field-name": "name"}, (x) => `<table><tbody><tr>${x}</tr></tbody></table>`,`<Response><Entity id="eid-1234" name="the-name"><Version id="vid-2345"/></Entity></Response>`);
+    var next = cell.firstElementChild;
+    assert.equal(next.tagName, "TABLE", "tagName = TABLE");
+    next = next.firstElementChild;
+    assert.equal(next.tagName, "TBODY", "tagName = TBODY");
+    next = next.firstElementChild;
+    assert.equal(next.tagName, "TR", "tagName = TR");
+    next = next.firstElementChild;
+    assert.equal(next.tagName, "TD", "tagName = TD");
+    next = next.textContent;
+    assert.equal(next, "the-name", "name = the-name");
+});
+
+
+QUnit.test("template select-table-cell (id only) ", function(assert){
+    let cell = callTemplate(this.queryXSL, "select-table-cell", {"entity-id": "eid-1234", "field-name": "id"}, (x) => `<table><tbody><tr>${x}</tr></tbody></table>`,`<Response><Entity id="eid-1234"/></Response>`);
+    var next = cell.firstElementChild;
+    assert.equal(next.tagName, "TABLE", "tagName = TABLE");
+    next = next.firstElementChild;
+    assert.equal(next.tagName, "TBODY", "tagName = TBODY");
+    next = next.firstElementChild;
+    assert.equal(next.tagName, "TR", "tagName = TR");
+    next = next.firstElementChild;
+    assert.equal(next.tagName, "TD", "tagName = TD");
+    next = next.textContent;
+    assert.equal(next, "eid-1234", "id = eid-1234");
+});
+
 /* MISC FUNCTIONS */
 function getQueryForm(queryXSL) {
     var html = callTemplate(queryXSL, "caosdb-query-panel", {});