xsl:where-populated

Used to allow conditional content construction to be made streamable. Used to avoid outputting an element if it would have no children.

Category: instruction
Content: sequence-constructor
Permitted parent elements: any XSLT element whose content model is sequence-constructor; any literal result element
Element has no attributes

Notes on the Saxon implementation

New in XSLT 3.0, and implemented since Saxon 9.7.

Examples

The following code generates a wrapper element for a non-empty sequence, however it is not guaranteed-streamable because it processes child event elements more than once:

<xsl:if test="exists(event)"> <events> <xsl:copy-of select="event"/> </events> </xsl:if>

To make this streamable, it can be rewritten using the xsl:where-populated instruction:

<xsl:where-populated> <events> <xsl:copy-of select="event"/> </events> </xsl:where-populated>

Links to W3C specifications

XSLT 3.0 Specification

See also

xsl:on-empty

xsl:on-non-empty