Extracting portion of xml

Here should go questions about transforming XML with XSLT and FOP.
elmpp
Posts: 2
Joined: Wed Aug 23, 2006 11:30 am

Extracting portion of xml

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
elmpp
Posts: 2
Joined: Wed Aug 23, 2006 11:30 am

Post 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.
Post Reply