[xsl] Need a little help with xsl:evaluate

Subject: [xsl] Need a little help with xsl:evaluate
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 30 Jun 2024 09:15:23 -0000
Hi Folks,

I want to evaluate the XPath expression that is inside the <predicate>
element:

<mappings>
    <mapping>
        <Airport_Name>GENERAL EDWARD LAWRENCE LOGAN </Airport_Name>
        <name>GENERAL EDWARD LAWRENCE LOGAN</name>
        <predicate>normalize-space(../Airport_Name) eq ../name</predicate>
    </mapping>
</mappings>

Here's how I tried to evaluate the XPath expression:

<xsl:template match="/">
      <verification-results>
            <xsl:for-each select="/mappings/mapping/predicate">
                <result-of-evaluating-predicate>
                    <xsl:evaluate xpath="."/>
                </result-of-evaluating-predicate>
            </xsl:for-each>
      </verification-results>
</xsl:template>

When I execute the template rule, I get this error message:

Error in xsl:evaluate/@xpath
XPDY0002  Dynamic error in expression {normalize-space(../Airport_Name) eq
../name} called
  using xsl:evaluate. Caused by net.sf.saxon.trans.XPathException: The context
item for axis
  step ./parent::(element()|document-node()) is absent. Found while atomizing
the first
  argument of fn:normalize-space()

What am I doing wrong? How to fix it?

/Roger

Current Thread