Re: [xsl] Re: How to express this in XPath: "when condition do action" where condition cannot be evaluated until data arrives later

Subject: Re: [xsl] Re: How to express this in XPath: "when condition do action" where condition cannot be evaluated until data arrives later
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Dec 2022 14:28:39 -0000
Am 12/20/2022 um 2:46 PM schrieb Roger L Costello costello@xxxxxxxxx:
Thank you Martin and BR Chrisman for your comments. [BR: your idea about
using UNIX shell commands is interesting, and one that I will think about. My
description of the UNIX 'trap' command was only intended to show a capability
in another system (UNIX shell programs) that provide the kind of capability
that I seek in XPath.]

Let me relax my requirement that the "when condition do action"
functionality be implemented exclusively in XPath. Let's also allow XSLT.
Also, let's allow extension functions.

Given those relaxed requirements, could the functionality that I seek be
implemented like this:

Read the next XML document. If the XML document contains data about cars then Call an XSLT function, f:waitForPoliceReport() The function uses an extension function to call a Java program which waits (sleeps) until the police report arrives. When the police report arrives, the Java program wakes up and returns control to the XSLT function, which returns the PoliceReport.xml document. The police report is then queried and either "stolen" or "" is output.

I am not a Java programmer so I don't know if Java can implement "wait
(sleep) until the police report arrives and then wake up and return control to
the XSLT function".


In what way does the program or the system know that "the police report has arrived"? Is there e.g. a certain file available in a certain location?


For the Java experts out there, is this something that Java can do? For the
XSLT experts out there, if the Java program can be implemented, can XSLT
invoke the Java program and pause its execution until the Java program
returns?

Is Java the best language to implement "wait (sleep) until the police report
arrives and then wake up and return control to the XSLT function"? Does SAXON
support extension function calls to other languages, besides Java? Does SAXON
support extension function calls to UNIX script programs?

Current Thread