[xsl] looking for a visually clean way to enable/disable templates

Subject: [xsl] looking for a visually clean way to enable/disable templates
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Dec 2022 18:25:51 -0000
Hi everyone,

Given a template with a predicate structure:

<xsl:template match="element[blah blah[blah]
                         [blah blah]]
                       [blah blah[blah]
                         [blah blah]]
                       [blah blah blah]">

I would like to enable or disable the template with a parameter:

<xsl:param name="do.this.thing" as="xs:boolean" select="false()"/>

I tried adding an enabling-variable predicate at the beginning or end, but it
seems to get visually lost:

<xsl:template match="element[$do.this.thing]
                       [blah blah[blah]
                         [blah blah]]
                       [blah blah[blah]
                         [blah blah]]
                       [blah blah blah]">

<xsl:template match="element[blah blah[blah]
                         [blah blah]]
                       [blah blah[blah]
                         [blah blah]]
                       [blah blah blah]
                       [$do.this.thing]">

I also tried adding the enabling-variable predicate to the root element, which
visually separates it a bit better:

<xsl:template match="/*[$do.this.thing]//
                       element[blah blah[blah]
                           [blah blah]]
                         [blah blah[blah]
                           [blah blah]]
                         [blah blah blah]">

My actual stylesheet has multiple features, each feature enabled by its own
parameter, each parameter enabling its own set of templates. Does anyone have
a favorite way of enabling/disabling templates in a way that does not get lost
in the match expression?

Thank you!

-----
Chris Papademetrious
Tech Writer, Implementation Group
(610) 628-9718 home office
(570) 460-6078 cell

Current Thread