[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Resolving character entities

Subject: Re: Resolving character entities
From: "Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Feb 2024 16:55:43 -0000
Re:  Resolving character entities
Phase 1: the parser converts character entities into characters. Phase 2: the
XSLT processor manipulates characters. Phase 3: the XSLT processor passes
characters to the serializer for output, which escapes them if they need
escaping. There's no way that phase 3 can be influenced by what happened in
phase 1.

Michael Kay
Saxonica



> On 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/3500899> (by
email <>)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.