Re: [xsl] Entities from source doctype?

Subject: Re: [xsl] Entities from source doctype?
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 8 Aug 2008 09:50:19 +0100
The thing I was working on won't actually help you here (but maybe it
should...)

You could use it as a starting point though - you need to implement
your own LexicalHandler and then look for your entity in the
startEntity event which will occur between the startDTD and endDTD
events.

I had to postpone working on it mainly because the day job picked up,
and because it seems the start and end events for entity references in
the XML didn't seem to wrap the expanded entity value (making the main
goal of preserving unexpanded entities unachievable) - I did ask about
it on xml-dev but got zero replies... perhaps it was too technical and
not political enough...

;-)


2008/8/8 Michael Kay <mike@xxxxxxxxxxxx>:
>> Can I fetch an entity value that's defined in the doctype
>> portion of a source document, but not used by name anywhere
>> else in the source document?
>
> Not in pure XSLT, this information isn't passed by the XML parser to the
> XSLT processor.
>
> However, Andrew Welch has produced some tools that could help, see
>
> http://markmail.org/message/xjs5apabmaamphnt
>
> Michael Kay
> http://www.saxonica.com/
>
>>
>> For example, say the source xml document looks something like this:
>>
>> <!DOCTYPE mydoctype [
>> <!ENTITY mynote  "this is a special note" > ]> <mydoctype>
>>        <specialnote/>
>> </mydoctype>
>>
>>
>> I can't use the unparsed-entity-uri function, because I don't
>> know the name of the entity: It's never used by name.
>> Instead, if I come across the 'specialnote" element, I want
>> to substitute the value stored in the 'mynote' entity.
>>
>> Can I fetch the value of the "mynote" entity or must it be
>> used (or name known) in order to access it?
>>
>>


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread