in reply to Re: Replace MathML content using Twig
in thread Replace MathML content using Twig

Thank you so much!!
That is very helpful for me.
BTW
Can I add some conditions in <subst>?
The original xhtml file:
.... <mml:mi>s</mml:mi> <mml:mi>sin</mml:mi> ..

Only <mml:mi>s</mml:mi> just replace with <mml:mi>x</mml:mi>.
the result:
New xhtml file
.... <mml:mi>x</mml:mi> <mml:mi>sin</mml:mi> ..

Replies are listed 'Best First'.
Re^3: Replace MathML content using Twig
by GrandFather (Saint) on May 10, 2011 at 11:14 UTC

    Sure. Change the sub to:

    sub subst { my ($twig, $value) = @_; $value->subs_text ('^s$', 'x'); $value->print (); }

    I can thoroughly recommend the XML::Twig documentation by the way. It is long, but there are some really good examples.

    True laziness is hard work