Re: [xsl] Inserting Entities into an XML file

Subject: Re: [xsl] Inserting Entities into an XML file
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Wed, 7 Jun 2006 09:26:53 +0100
On 6/6/06, Chad Chelius <cchelius@xxxxxxxxxxxxxxx> wrote:
I have a project where I need to insert specific entities throughout
an XML document for some of the basic entities like (', &, ", etc.)
but also for some very specific math equation symbols. I know what
entities need to be inserted but I'm not quite sure what the best way
would be to go about this. Initially I am thinking a complex find/
change routine, but before I spend a lot of time doing that, I'd like
to know if anyone has a better mousetrap to accomplish this task. Any
ideas?

You can't use XSLT to write entities into the output, or process entities from the input - XSLT has no concept of entities - they are an on-disk thing, whereas XSLT only deals with in-memory trees (the XML parser has expanded them before XSLT gets to see the input tree).

One solution is to write a custom serialiser that would write out
proprietary elements as entities, but that's a lot of work.

Isn't this what MathML was designed for?

Regarding your first point of "I need to insert specific entities
throughout an XML document for some of the basic entities like (', &,
", etc.)" this doesnt make that much sense I'm afraid - maybe post an
example of what you are trying to achieve?

cheers
andrew

Current Thread