0

I have the below XML

<?xml version="1.0" encoding="UTF-8"?>
    <SpecializedActions>
        <SpecializedAction>
            <Name>ActivateAAA_Account</Name>
            <Function>holaaalib:activate($csmHeader, $component, $taskName, $osmOrderId)</Function>
        </SpecializedAction>
        <SpecializedAction>
            <Name>ActivateIMSAccount</Name>
            <Function>imsLib:activate($csmHeader, $component, $taskName, $osmOrderId)</Function>
        </SpecializedAction>
    </SpecializedActions>

and i tried to invoke the functions in my generic xQuery like this

if (fn:exists($specializedAList/SpecializedAction[Name/text() = $specializedActionName])) then
    $specializedAList/SpecializedAction[Name/text() = $specializedActionName]/Function/text()

but that way it will return a text 'imsLib:activate($csmHeader, $component, $taskName, $osmOrderId)'. Is there a method to cast it as an xQuery expression?

Jon Heller
  • 34,999
  • 6
  • 74
  • 132
pavloskkr
  • 1
  • 1
  • Which version, which edition of Saxon is that? And is that all done with XQuery, or why is there a tag for XSLT as well? – Martin Honnen Sep 04 '20 at 13:40
  • And where does Oracle fit in? Is there a reason you chose those tags but omitted the Saxon tag? – Alex Poole Sep 04 '20 at 14:53
  • Xquery 1.0, Saxon EE 9.8.0.12 Yes it's all done with XQuery. XSLT was a mistake. Oracle fits in because it's about Oracle's Order and Service Management – pavloskkr Sep 04 '20 at 15:08

1 Answers1

1

XSLT 3.0 has an instruction xsl:evaluate which can be used to evaluate an XPath expression read from a source document (or conjured up at run-time in some other way). There's no standard equivalent in XQuery (though in principle you could do it using fn:transform() which dynamically invokes an XSLT transformation.

Saxon-PE and higher have an extension saxon:evaluate() which does much the same thing, and can be invoked from XQuery.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164