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

Re: Why aren't ENTITY declarations in a main styleshee

Subject: Re: Why aren't ENTITY declarations in a main stylesheet visible in the included stylesheets?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Jun 2022 11:27:53 -0000
Re:  Why aren't ENTITY declarations in a main styleshee
I've always thought it would be nice to have a mode of operation where the XML
can contain entity references, but the expansions are supplied by the
application using the parser API, rather than having to be present in the DTD.
That would open up lots of interesting possibilities, like a version of the
doc() function that constructs a parameterised document.

Michael Kay
Saxonica

> On 2 Jun 2022, at 12:20, Norm Tovey-Walsh ndw@xxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> I thought that an xs:include is essentially a "macro substitution", in
>> which case the entity declaration should be visible, yes?
>
> Nope. The XPath data model doesnbt have entities in it, so the parser
> expands them away. (In principle, the parser doesnbt have to, but the
> result wonbt work in XSLT if it doesnbt.)
>
>> I don't want to have ENTITY declarations scattered around multiple
>> files. What's the best way to deal with ENTITIES?
>
> If all your tooling will read the external subset, you can do something
> like this:
>
> <!DOCTYPE whatever SYSTEM "whatever.dtd" [
> <!ENTITY % myDecls SYSTEM "decl.ent">
> %myDecls;
> ]>
> <whatever>
> &spoon;
> </whatever>
>
> where decl.ent contains the entities, for example:
>
> <!ENTITY spoon "Spoon!">
>
> You can get them into your XSLT that way too:
>
> <!DOCTYPE xsl:stylesheet [
> <!ENTITY % myDecls SYSTEM "decl.ent">
> %myDecls;
> ]>
> <xsl:stylesheet>b&
>
> But you have to do that in every file (including the ones you include or
> import).
>
> See also this note from ~20 years ago:
>
>  https://norman.walsh.name/2003/09/27/dtds
>
> :-)
>
>                                        Be seeing you,
>                                          norm
>
> --
> Norman Tovey-Walsh <ndw@xxxxxxxxxx>
> https://nwalsh.com/
>
>> Why do politicians lie? Because it works.

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.