[xsl] XPath is a composable language ... does that mean I can create an XPath expression for a then-clause and simply plug it into an if-then-else?

Subject: [xsl] XPath is a composable language ... does that mean I can create an XPath expression for a then-clause and simply plug it into an if-then-else?
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 4 Dec 2022 17:11:06 -0000
Hi Folks,

I have this English sentence:

if the machine = "Intel 386 or later processors and compatible processors"
then ... else ... .

I deliberately elided the then-clause and the else-clause.

I need to turn that English sentence into XPath. I created this XPath:

if (/Windows_Executable_File/Headers/File_Header/Machine = "Intel 386 or later
processors and compatible processors")
then
    ...
else
    ...

Next, I created an XPath expression for the then-clause. I created the XPath
independent of its enveloping if-then-else. Let me denote the XPath expression
I created as: then-clause-XPath.

I did the same for the else-clause.

I then plugged then-clause-XPath and else-clause-XPath into the if-then-else:

if (/Windows_Executable_File/Headers/File_Header/Machine = "Intel 386 or later
processors and compatible processors")
then
    then-clause-XPath
else
    else-clause-XPath

The XPath 3.0 specification says this:

      XPath 3.0 is a composable language

Does "composable language" mean I can do as I describe above and the result
will be a valid XPath expression?

That is, can I develop an XPath expression for the then-clause completely
independent of its enveloping if-then-else and then simply plug the XPath into
the if-then-else? Ditto for the else-clause? Does "composable language" mean I
can do this kind of thing?

/Roger

Current Thread