|
Subject: Re: [xsl] emulating sprintf in XSLT From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 28 Aug 2022 23:52:27 -0000 |
On Sun, 2022-08-28 at 23:06 +0000, Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx wrote:
> Hi everyone,
>
> If you need sprintf()-like functionality in XSLT, one approach is to
> use the arrow (=>) operator to apply a series of replace()
> operations:
Another, in XSLT 3, is to use text value templates:
<p><h4>Estimated reading time:</h4>
<p>{$minutes} {if ($minutes eq 1) then 'minute' else 'minutes'}</p>
This requires expand-text="yes" on an XSLT element ancestor, or
xsl:expand-text="yes" on a direct element contstructor (like the p
element in the example above).
liam
--
Liam Quin - paligo.net, delightfulcomputing.com
Cancer gofundme https://www.gofundme.com/f/5u9v7-every-little-helps
Vintage pictures & texts https://www.fromoldbooks.org/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] emulating sprintf in XSLT, Chris Papademetrious | Thread | Re: [xsl] emulating sprintf in XSLT, Wegmann, Frank frank |
| [xsl] emulating sprintf in XSLT, Chris Papademetrious | Date | Re: [xsl] emulating sprintf in XSLT, Wegmann, Frank frank |
| Month |