cx:until-unchanged — Iterates to a fixed point.


  name? = NCName>


The cx:until-unchanged step is an extension compound step. There's no provision in the language for defining these steps, but that doesn't mean implementors can't.

On the first iteration, the cx:until-unchanged step provides (on the #current port) the document that it reads from the default readable port[3] to the subpipeline it contains.

The subpipeline must produce exactly one output document on cx:until-unchanged’s single output port.

On the second and subsequent iterations, the result of the preceding iteration is provided on the #current port.

Iteration continues until the document produce is deep-equal to the document produced on the previous iteration.

Here's a trivial example:

<p:declare-step xmlns:p=""
                name="main" version="1.0">
  <p:input port="parameters" kind="parameter"/>
  <p:output port="result" sequence="true" primary="true"/>

  <p:identity name="id">
    <p:input port="source">

    <p:output port="result"/>
      <p:input port="stylesheet">
          <xsl:stylesheet xmlns:xsl=""

            <xsl:template match="doc">
              <xsl:variable name="count" select="xs:integer(.)"/>
                <xsl:when test="$count &lt; 5">
                  <doc><xsl:value-of select="$count+1"/></doc>
                  <xsl:sequence select="."/>


The stylesheet adds one to the integer value of the document that it is styling as long as the value is less than 5.

The result of running this pipeline is that the stylesheet is run five times, producing documents with the “values” 2, 3, 4, 5, 5. At that point the loop terminates and the last document,


is returned.

[3]Yes, it's a bug that there's no equivalent of p:iteration-source for this step.