Surely <test/> is canonical, and <test></test> isn't?
Or maybe I should look-up what canonical means in this context.
And I guess the next question would be "why" as all XML parsers are (or should
be) happy with the single form, shouldn't they.
Regards,
Richard.
From: Wendell Piez wapiez@xxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: 17 June 2022 14:55
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: How to retain the end tag when outputting an empty
element?
Caution! External email. Do not open attachments or click links, unless this
email comes from a known sender and you know the content is safe.
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<mailto:costello@xxxxxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>> 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.<https://eur01.safelinks.protection.outlook.com/?ur
l=http%3A%2F%2Fgithub.com%2Fwendellpiez.&data=05%7C01%7Crichard.kerry%40atos.
net%7Cab3b68f5ed7e4d6fdb9108da5068fd28%7C33440fc6b7c7412cbb730e70b0198d5a%7C0
%7C0%7C637910709706903888%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjo
iV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8Cz6kCTioSEYJ03
RVQeUN4YW%2Bm%2B7%2FUvENE4tIGv9VeA%3D&reserved=0>..
...gitlab.coko.foundation/wendell...
XSL-List info and
archive<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
mulberrytech.com%2Fxsl%2Fxsl-list&data=05%7C01%7Crichard.kerry%40atos.net%7Ca
b3b68f5ed7e4d6fdb9108da5068fd28%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C
637910709706903888%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMz
IiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KoMcn2%2Bi9V1LcH%2BgJu
vforqQ5PXo2vcjjx8dXnesm7k%3D&reserved=0>
EasyUnsubscribe<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2
F%2Flists.mulberrytech.com%2Funsub%2Fxsl-list%2F2528992&data=05%7C01%7Crichar
d.kerry%40atos.net%7Cab3b68f5ed7e4d6fdb9108da5068fd28%7C33440fc6b7c7412cbb730
e70b0198d5a%7C0%7C0%7C637910709706903888%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4w
LjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=
jtL9WFEoHPdCpGMh9EIvokNZikmn8B2iDBe2%2BN6Z40o%3D&reserved=0> (by email<>)
|