Subject: Re: [xsl] [XSLT Streaming] I xsl:iterate over airport primary records; how do I get the following sibling airport continuation record? From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 31 Jan 2025 19:40:35 -0000 |
Hi Folks,things, airport primary records:
I am stream-processing a huge air navigation file that contains, among other
select="ARINC/record/ARINC_424-18_4_1_7_1_Airport_Primary_Records">
<ARINC> ... <record> <ARINC_424-18_4_1_7_1_Airport_Primary_Records> data about an airport </ARINC_424-18_4_1_7_1_Airport_Primary_Records> </record> ... </ARINC>
In my program, I iterate over the airport primary records:
<xsl:iterate
process an airport </xsl:iterate>
Some--not all--airport primary records have a continuation record, which
immediately follows--is the first following sibling--the airport primary record:
<ARINC_424-18_4_1_7_3_Airport_Flight_Planning_Continuation_Records>
<ARINC> ... <record> <ARINC_424-18_4_1_7_1_Airport_Primary_Records> data about an airport </ARINC_424-18_4_1_7_1_Airport_Primary_Records> </record> <record>
additional data about the airport</ARINC_424-18_4_1_7_3_Airport_Flight_Planning_Continuation_Records>
record and store it into a variable:</record> ... </ARINC>
Within the xsl:iterate loop, I tried to obtain the following continuation
select="ARINC/record/ARINC_424-18_4_1_7_1_Airport_Primary_Records">
<xsl:iterate
<xsl:variable name="flt-pln-cont"
select="copy-of(../following-sibling::record[1]/ARINC_424-18_4_1_7_3_Airport_ Flight_Planning_Continuation_Records)"/>
create-airports.xsl:process the airport and its continuation data </xsl:iterate>
When I run my program, I get this error message:
Static error at xsl:source-document on line 10 column 47 of
XTSE3430 The body of the xsl:source-document instruction is notstreamable
* Cannot use the following-sibling axis when context posture is CLIMBING(line 16)
* Expressionparent::(element()|document-node())/following-sibling::record[1] requires
sorting nodes into document order
What is the correct way to do this?
It is not clear to me why you process e.g. ARINC/record/ARINC_424-18_4_1_7_1_Airport_Primary_Records if a "record" element can also contain e.g. ARINC_424-18_4_1_7_3_Airport_Flight_Planning_Continuation_Records, your outer xsl:iterate would already have skipped the ARINC_424-18_4_1_7_3_Airport_Flight_Planning_Continuation_Records elements if it only looks for ARINC_424-18_4_1_7_1_Airport_Primary_Records.
As for ways to solve this, it is not clear how large a "record" element is, e.g. if you perhaps could just use
B B B B B <xsl:param name="previous-record" as="element(record)?" select="()"/>
B B B B <xsl:next-iteration> B B B B B B <xsl:with-param name="previous-record" select="."/>
There are also capturing accumulators (a Saxon extension in XSLT 3 but streaming is only implemented by Saxon anyway) that can help store nodes.
B B <xsl:for-each-groups select="ARINC/record!copy-of()" group-starting-with="record[ARINC_424-18_4_1_7_1_Airport_Primary_Records]">
None of that is pure streaming, of course, but unless you buffer the "ARINC_424-18_4_1_7_1_Airport_Primary_Records" data in a map I don't think there is a way to look back with streamed processing.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [XSLT Streaming] I xsl:iterat, Roger L Costello cos | Thread | Re: [xsl] [XSLT Streaming] I xsl:it, Liam R. E. Quin liam |
[xsl] [XSLT Streaming] I xsl:iterat, Roger L Costello cos | Date | Re: [xsl] [XSLT Streaming] I xsl:it, Liam R. E. Quin liam |
Month |