This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: The XSL-List Digest V2 #608 Entities.



> Mid stream I use a document() to retrieve and
> process another xml file (file2)
> The doctype, local entities I have defined for
> file1 are completely dissociate from those of
> file2. Am I right in this? 

yes

> And any entities I
> define within the stylesheet, they are only
> 'valid for use' within the stylesheet?

yes


The point is that document() supplies a node set and similarly
the original document and the stylesheet produce node sets
(in each case a set of one node, the root node of the respective
documents)

but to produce a node set you have to parse the things as XML 1.0
documents and that means that the scope of entity declarations has to be
as described in XML 1.0.  If you have the file

<foo>
&xxx;
</foo>

then as it stands it is not well formed XML, and so nothing the XSL spec
says about document() could change that, the file won't get past an XML
parser.

To make it well formed you either have to stick a DOCTYPE at the top of
the file which declares xxx or you can include this file into another
XML document (that does have such a DOCTYPE) but as an external parsed
entity, not as an XML document. External parsed entities ie something
declared via <!ENTITY filewithxxx SYSTEM "aaa.xml"> .... &filewithxxx;
are expanded by the XML parser as part of building the node tree for XSL
so such an inclusion is invisible to XSL it as if the included file had
been copied into the including file.

David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]