![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
Re: MathML 2 ascii?by mirod (Canon) |
on Jan 27, 2005 at 08:49 UTC ( [id://425505]=note: print w/replies, xml ) | Need Help?? |
Below is how I would do it. It should be extensible to handle other units. It assumes apply is only used with 2 arguments, but this shouldn't be a problem, if it is used with more I would assume that it is for multiplication, which doesn't need any symbol to be applied. If I were you I would first create a version that would just output the unit -> ascii conversion, and run it on all documents, or on a set of documents. Something like removing the twig_print_outside_roots, instead of printing the content of unit store it in a hash $_->sprint => $_->text, and dump the content of that hash once you're done. This will give you all units in the document, so you can check the transformation. If you are not happy with the results and working at XML level is too much of a pain you can also add a final transformation there, with a simple hash initial_result => what_you_want. BTW are you really limited to pure ascii? Displaying J/m² could be a nice touch.
In Section
Seekers of Perl Wisdom
|
|