Re: [xsl] Help to prevent copying of prefix

Subject: Re: [xsl] Help to prevent copying of prefix
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 8 Mar 2026 22:37:59 -0000
oops posted the input twice not the stylesheet,:-)

stylesheet

<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";
xmlns:atom="http://www.w3.org/2005/Atom";
xmlns:xhtml="http://www.w3.org/1999/xhtml";
exclude-result-prefixes="atom xhtml">

 <xsl:template match="*">
  <xsl:element name="{local-name()}" namespace="{namespace-uri()}">
   <xsl:copy-of select="@*"/>
   <xsl:apply-templates/>
  </xsl:element>
 </xsl:template>

</xsl:stylesheet>


On Sun, 8 Mar 2026 at 22:26, David Carlisle d.p.carlisle@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> your example input wasn't well formed, but
>
> <atom:summary type="xhtml"
>      xmlns:atom="http://www.w3.org/2005/Atom";
>      xmlns:xhtml="http://www.w3.org/1999/xhtml";
>      >
>   <xhtml:div>
>     <xhtml:p>
>       We are happy to announce that
>       <xhtml:a href="gemini://syndikate.i2p">Syndikate</xhtml:a>
>       was publicized.
>     </xhtml:p>
>   </xhtml:div>
> </atom:summary>
>
>
> the stylesheet
>
> <atom:summary type="xhtml"
>      xmlns:atom="http://www.w3.org/2005/Atom";
>      xmlns:xhtml="http://www.w3.org/1999/xhtml";
>      >
>   <xhtml:div>
>     <xhtml:p>
>       We are happy to announce that
>       <xhtml:a href="gemini://syndikate.i2p">Syndikate</xhtml:a>
>       was publicized.
>     </xhtml:p>
>   </xhtml:div>
> </atom:summary>
>
>
> produces
>
> <summary xmlns="http://www.w3.org/2005/Atom"; type="xhtml">
>   <div xmlns="http://www.w3.org/1999/xhtml";>
>     <p>
>       We are happy to announce that
>       <a href="gemini://syndikate.i2p">Syndikate</a>
>       was publicized.
>     </p>
>   </div>
> </summary>
>
>
> On Sun, 8 Mar 2026 at 19:29, Schimon Jehudah sch@xxxxxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> Greetings.
>>
>> I am attempting to copy the XHTML content of element atom:summary
>> without the prefix of "xhtml", by declaring the XML Namespace of "xhtml"
>> at the element which contains it.
>>
>> Content
>> -------
>>
>> <atom:summary type="xhtml">
>>   <xhtml:div>
>>     <xhtml:p>
>>       We are happy to announce that
>>       <xhtml:a href="gemini://syndikate.i2p">Syndikate</xhtml:a>
>>       was publicized.
>>     <xhtml:p>
>>   </xhtml:div>
>> </atom:summary>
>>
>>
>> XSLT
>> ----
>>
>> <p xmlns="http://www.w3.org/1999/xhtml"; class="summary" type="xhtml">
>>   <xsl:copy-of select="$summary/xhtml:*"/>
>> </p>
>>
>>
>> Result
>> ------
>>
>> <p xmlns="http://www.w3.org/1999/xhtml"; class="summary" type="xhtml">
>>   <xhtml:div>
>>     <xhtml:p>
>>       We are happy to announce that
>>       <xhtml:a href="gemini://syndikate.i2p">Syndikate</xhtml:a>
>>       was publicized.
>>     <xhtml:p>
>>   </xhtml:div>
>> </p>
>>
>>
>> Desired result
>> --------------
>>
>> <p xmlns="http://www.w3.org/1999/xhtml"; class="summary" type="xhtml">
>>   <div>
>>     <p>
>>       We are happy to announce that
>>       <a href="gemini://syndikate.i2p">Syndikate</a>
>>       was publicized.
>>     <p>
>>   </div>
>> </p>
>>
>>
>> Note
>> ----
>>
>> Directive exclude-result-prefixes="xhtml" did not work for me, or I
>> executed it wrongly.
>>
>> I would appreciate any help.
>>
>>
>> Kind reagrds,
>> Schimon
>>
>>
>> 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