Re: [xsl] Re: How to express this in XPath: "whenconditiondoaction" where condition cannot be evaluated until data arriveslater

Subject: Re: [xsl] Re: How to express this in XPath: "whenconditiondoaction" where condition cannot be evaluated until data arriveslater
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Dec 2022 18:08:53 -0000
Hi Folks,

A colleague gave me this (very cool) approach.

A Car.xml document is input and placed inside a <Document> element:

<Document>
    <Car>
        <Make>Toyota</Make>
        <Model>Avalon</Model>
        <LicensePlate>12345</LicensePlate>
    </Car>
    <State></State>
</Document>

The <State> element will be used to store Car inputs. Initially it is empty.

If there is no PoliceReport.xml, then output Document, with the Car moved into
the <State> element.

Read in the next Car.xml, along with Document.xml and put the next Car into
<Document>

<Document>
    <Car>
        <Make>Honda</Make>
        <Model>Accord</Model>
        <License>abcde</License>
    </Car>
    <State>
        <Car>
            <Make>Toyota</Make>
            <Model>Avalon</Model>
            <LicensePlate>12345</LicensePlate>
        </Car>
    </State>
</Document>

Notice the first car is now inside <State> to reflect the state of the system
(namely, previously we processed data for the Toyota Avalon).

Repeat this process until a PoliceReport.xml document arrives. When it
arrives, query <State> for a matching <Car> element and output "Stolen" or ""
for the car.

This approach gets you out of dealing with time. Time goes away as part of the
definition of the system.

Wicked cool!

/Roger

Current Thread