[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] recognize character entities


Subject: Re: [xsl] recognize character entities
From: Frank Marent <frank.marent@xxxxxxxxxxx>
Date: Wed, 30 Aug 2006 07:48:10 +0200

mike

no, thanks for your statements. i'm happy to have all these experts around taking part of my problem.

we have a problem within mathml. this is my concrete problem: we have to change by xslt all m:mo elements that consist of one special character (entity reference) to symbol font for output. the input is coming from design science mathflow on arbortext editor:

<m:mo>&divide;</m:mo>

to

<m:mo fontfamily="Symbol">&divide;</m:mo>

this is to address the correct font in the output equation eps files done by mfequation server from design science. right now we're taking a sar (search and replace - i like that abbrevation) tool to do that:

  [Search /x]
  <m:mo>&*[];</mo>
  [Replace]
  <m:mo fontfamily='Symbol'>&%1;</mo>

that's working. but means additional work since we have no continuous workflow and have to do manual work. an xslt process should identify all m:mo elements that consist of one entity reference. that is the background of my question.

best regards
frank



Am 29.08.2006 um 19:38 schrieb Waters, Michael, Springer US:

Is it in the spirit of XML to let the parser expand the entity
references back to themselves? For example, in the above
situation, is
this a reasonable thing to do:

<!ENTITY euro "&amp;euro;">


It might be (but probably isn't:-) But that isn't making teh entity
reference convert back to itself, it's making it expand to the 6
characters &euro;, not to an entity reference.

the real question is why are you looking for the entity refs.
The whole point of entities are supposed to be as an author convenience
so if the _author_ doesn't have a euro key on his or her keyboard and
finds it convenient to instead type &euro; that they may do so safe in
the knowledge that alllater applications will treat &euro; the same as
if the character had been entered directly.


So if you make &euro; be something else then the "spirit" has
been broken
in that now the character and the entity ref will do different things.


Do you really need to look for entity refererences or do you need to
look for characters that are normally entered via entity references?

If you do end up redefining teh entities, it's easier to test for
<entity name="euro"/> in xslt1 than it is for a string containing
&amp;euro; and much easier to use xslt to convert it back to a single
character.

But the question is really _why_ do you want to treat
&euro; differently from &#8364; ?


Sorry, I apologize. I interjected the question above on entity handling, but failed to note that I wasn't the original poster for this thread. I was curious about the poster's situation because I came across something similar some time ago. Unfortunately, I can't detail the exact circumstances of why I needed to do such a thing. Vaguely, it had something to do with creating a mapping table of some sort.

Anyway, the bottom line is that, obviously, I don't know the reasoning WHY behind the original poster's query.

Sorry I misspoke. Didn't mean to sidetrack the discussion.

Mike Waters


Current Thread
Keywords