Page 1 of 1

Extracting portion of xml

Posted: Wed Aug 23, 2006 11:30 am
by elmpp
Hey,

I'm working with an xml feed which contains portions of rss, latex and mathML. I'm trying to create a gif image using the mathML portions, by passing to a binary using system() (php). Problem is, i see no way of extracting the xml using xslt and preserving the tags, ie doing a <xsl:value-of select="blah"> results in the text nodes of the children returned. Thought there must be a way of selecting a nodeset and then calling a function to kind of serialize it back into xml as text.

Probably more of a xsl problem, but any help would be great. Don't wanna be parsing the document myself to be honest

Posted: Wed Aug 23, 2006 4:46 pm
by sorin_ristache
Hello,

If you want the element blah with all the child elements and their tags you should use <xsl:copy-of select="blah"/> instead of <xsl:value-of select="blah"/> in the XSLT stylesheet. I think you can write a stylesheet which only extracts the MathML part, apply it by calling an XSLT processor from PHP or other language and convert the result of the transformation which is a MathML document to an image.

Regards,
Sorin

Posted: Wed Aug 23, 2006 5:31 pm
by elmpp
Thanks so much - was actually resorting to passing the element id to a php function inside xslt and recursively parsing the xml for the portion i wanted. Had a nice little ini_set for execution time set to 900 seconds. I expect this may drop now...

Thanks again.