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: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Dec 2022 23:21:33 -0000
Hey Roger,

This is awesome, but it's not fair to your helpers. Basically the solution
you prefer is to decouple the two problems, namely the problem of
maintaining your cars.xml and your problem of updating reports based on
updated PoliceReport.xml.

But the only reason these were coupled in the first place is that you
coupled them, in your problem statement, which specified a particular
workflow.

Contributors to this list, while offering various ways of giving you what
you said you wanted, also hinted (or said outright) this would be much
easier if you didn't assume you even need the functionality you stipulate,
but found a different way to achieve your goal, maybe a slightly different
transformation architecture. Which is just what you eventually did.

I see this a lot - indeed I think it's an easy trap to fall into. But
instead of saying "can XPath do X", maybe the question should be "which
parts of this problem are XPath (or XSLT) problems and which problems are
easier to deal with somewhere else, assuming I can do it or easily have it
done for me?"

BTW, I like Eliot's idea. Move the problem into the cloud. I would not
recommend it, but I like it.

Cheers -- keep them coming,
Wendell


On Tue, Dec 20, 2022 at 1:09 PM Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> 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
> 
>
>

-- 
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...

Current Thread