Project

Profile

Help

Support #6123

closed

xsl:evaluate returns plain text instead of nodes

Added by Radu Coravu about 1 year ago. Updated 13 days ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2023-07-08
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

If we were to run with Saxon 11 this XSLT code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    xmlns:saxon="http://saxon.sf.net/"
    version="3.0">
    <xsl:template match="/">
        <xsl:param name="nodePath" select="'/root[1]/a[1]/text()[1]'" as="xs:string"></xsl:param>
        <xsl:variable name="var1">
            <xsl:evaluate xpath="$nodePath" context-item="/"/>
        </xsl:variable>
        <xsl:variable name="var2" select="saxon:evaluate($nodePath)">
        </xsl:variable>
        <xsl:copy-of select="$var1/parent::*"/>
        <xsl:copy-of select="$var2/parent::*"/>
    </xsl:template>
</xsl:stylesheet>

on this XML document:

<root>
    <a>dsadas</a>
</root>


The saxon:evaluate returns a text node which has context, it can go back to its parent element. The xsl:evaluate returns a plain string which can no longer be used to match its ancestors.

We use such node matches when computing xpath contexts for quick fixes.

So with Saxon 12 we can no longer use saxon:evaluate and the xsl:evaluate is not quite compatible.

Please register to edit this issue

Also available in: Atom PDF