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

Subject: Re: [xsl] looking for a visually clean way to enable/disable templates
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Dec 2022 18:36:50 -0000
<xsl:template use-when=" $do.this.thing" match="element">

David

On Mon, 19 Dec 2022 at 18:25, Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> 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
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

Current Thread