Re: [xsl] How to retain the end tag when outputting an empty element?

Subject: Re: [xsl] How to retain the end tag when outputting an empty element?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 17 Jun 2022 13:54:41 -0000
Roger,

One way is to see to it that the element has some kind of content

<xsl:template match="text()">
  <xsl:comment> burp </xsl:comment>
  <xsl:next-match/>
</xsl:template>

... although I would call this kind of desperate and not always a
"solution".

Cheers, Wendell


Cheers, Wendell

On Fri, Jun 17, 2022 at 8:15 AM Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> For this element:
>
> <test>foo</test>
>
> The following XSLT:
>
>     <xsl:template match="*">
>         <xsl:element name="{name(.)}">
>             <xsl:apply-templates />
>         </xsl:element>
>     </xsl:template>
>
>     <xsl:template match="text()" />
>
> Outputs this:
>
> <test/>
>
> How do I get the XSLT processor to output both the start tag and the end
> tag:
>
> <test></test>
>
> /Roger
>
> 
>
>

-- 
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...

Current Thread