exec, execve or system calls: demo
#include <stdlib.h>
#include <unistd.h>
int main(int argc, const char* args[])
{
    exitcode = system("xsltprox textonly.xslt input.xml > output");
//  exitcode = exec("xsltproc", "textonly.xslt", "input.xml");
    int exitcode;
}
Proceed to fopen output (or std::fstream reader("output") if you fancy). Note that system is quickly a security hole, so you shouldn't use it in critical apps (like daemons). 
Using exec you could redirect. So you could perhaps open a pipe() from your program, fork(), in the child assign the stdout filedescriptor to the pipe() (see dup2 call) and exec in the child. 
The parent process can then read the output from the pipe without need for a temp file. 
All of this should be on a zillion tutorials, which I don't have to the time to google for you right now.
May I suggest using perl or shell script. If you post an actual example I could show you the code in both shell and c/c++
Update here is how to do it with XSLT
textonly.xslt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">
        <xsl:for-each select="//*[text()]">
            <xsl:if test="text()">
                                <xsl:value-of select="text()"/>:
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
output demo:
o399hee@OWW00837 ~/stacko
$ xsltproc.exe textonly.xslt input.xml
 :
             hi this is first li :
             dsfn  sdlkf sfd :
     
    
grepfor parsing XML files.