Re: [xsl] [XSLT Streaming] I xsl:iterate over airport primary records; how do I get the following sibling airport continuation record?

Subject: Re: [xsl] [XSLT Streaming] I xsl:iterate over airport primary records; how do I get the following sibling airport continuation record?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 31 Jan 2025 19:42:19 -0000
On Fri, 2025-01-31 at 19:25 +0000, Roger L Costello costello@xxxxxxxxx
wrote:
>
> Static error at xsl:source-document on line 10 column 47 of create-
> airports.xsl:
> B  XTSE3430B  The body of the xsl:source-document instruction is not
> streamable
> B  *B  Cannot use the following-sibling axis when context posture is
> CLIMBING (line 16)

Haha therebs a chunk in the XSLT 3 course i give about streaming and
avoiding this sort of problem.

In streaming mode you can only go down. If you do go up, you can only
look at properties of the ancestors such as name(), not at their
children.

One way to do what you want might be to process record elements. Use a
parameter to store a copy of the primary record. Then when you see a
record,
if it's primary, process the copy of the stored one along with any
secondary records also stored in the parameter.

if it's secondary, add it to the parameter after the stored primary one
(for the next iteration).

that way if there are several secondary records, you'll get copies of
them all in the parameter along with their primary record.

at the end of the iteration process the parameter.

Use the copy-of() function to copy the current record, then look inside
to determine its type, because the copy will be "grounded" - outside
the stream.

Remember also you can call templates in a non-streaming mode, if you
pass them only "grounded" data.

liam

--
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread