Re: [xsl] Resolving character entities

Subject: Re: [xsl] Resolving character entities
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Feb 2024 16:00:06 -0000
amp lt and gt are pre-defined in xml so your definitions will be
essentially ignored (which is good as the definition of lt is not well
formed you need an extra level of &-quoting)
so the entity references were expanded on parsing but your serializer chose
to use the named references on serialising (it probably has options to use
hex NCR instead)
but the serialisation would be be the same however you input the < , as
&lt; or as &#x3c;

David


On Thu, 15 Feb 2024 at 15:52, rick@xxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi All,
>
>
>
> I have this as the input:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE subtask [
>
> <!ENTITY lt "&#38;">
>
> <!ENTITY gt "&#62;">
>
> <!ENTITY amp "&#38;">
>
> ]>
>
>
>
> <subtask>
>
>     <title>General Information</title>
>
>     <prcitem1>
>
>         <prcitem>
>
>             <para>This document provides &lt; repair instructions &amp;
> for the Fire Extinguisher components.</para>
>
>         </prcitem>
>
>     </prcitem1>
>
> </subtask>
>
>
>
> I want all of the entities to be resolved when I transform the file. This
> is my stylesheet:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>
>     xmlns:xs="http://www.w3.org/2001/XMLSchema";
>
>     xmlns:math="http://www.w3.org/2005/xpath-functions/math";
>
>     exclude-result-prefixes="xs math"
>
>     version="3.0" expand-text="yes">
>
>
>
>     <xsl:output indent="yes"/>
>
>
>
>     <xsl:template match="/">
>
>         <xsl:apply-templates/>
>
>     </xsl:template>
>
>
>
>     <xsl:mode on-no-match="shallow-copy"/>
>
>
>
> </xsl:stylesheet>
>
>
>
> This is my output:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <subtask>
>
>    <title>General Information</title>
>
>    <prcitem1>
>
>       <prcitem>
>
>          <para>This document provides &lt; repair instructions &amp; for
> the Fire Extinguisher components.</para>
>
>       </prcitem>
>
>    </prcitem1>
>
> </subtask>
>
>
>
> I was thinking that my $lt; should have been substituted with &#38;, etc.
> Does it not matter because these are bvalidb XML entities? Thank you.
>
>
>
> Rick
> 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