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

Subject: Re: [xsl] Re: How to express this in XPath: "when condition doaction" where condition cannot be evaluated until data arrives later
From: "Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Dec 2022 15:59:49 -0000
Could you abuse streaming by opening a document that continues to supply a
value that indicates no police report until a police report arrives,
something like:


    <xsl:variable name="policeReport" as="document-node()">
      <xsl:iterate
select="doc('localhost://webservice/wait-for-police-report')/*/*">
        <xsl:on-completion>
          <xsl:document>
            <xsl:sequence select="."/>
          </xsl:document>
        </xsl:on-completion>
        <xsl:break select="./self::police-report|./self::timeout"/>
      </xsl:iterate>
    </xsl:variable>


Where the web service can have some defined timeout setting to end the
process.

Cheers,

E.


_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> |
Twitter<https://twitter.com/servicenow> |
YouTube<https://www.youtube.com/user/servicenowinc> |
Facebook<https://www.facebook.com/servicenow>

From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tuesday, December 20, 2022 at 8:49 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] Re: How to express this in XPath: "when condition doaction"
where condition cannot be evaluated until data arrives later
[External Email]


Am 12/20/2022 um 3:32 PM schrieb Roger L Costello costello@xxxxxxxxx:
> Hi Martin,
>
>
>
>> 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?
>
>
> Yes, when PoliceReport.xml arrives it is placed in the same folder as the
Car.xml file.
>
>
>

Well, Java can "watch" a directory for changes see e.g.
https://docs.oracle.com/javase/tutorial/essential/io/notification.html<https:
//docs.oracle.com/javase/tutorial/essential/io/notification.html>
so it is certainly possible to implement something in Java but I have no
idea how such a function would fit into Saxon's use of Java extension
functions to XSLT/XPath/XQuery; perhaps Michael Kay shows up later and
can tell you more.

Current Thread