How to read values from "$newdom1 = $proc1->transformToDoc($inputdom1)"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sisu
    New Member
    • Feb 2010
    • 16

    #1

    How to read values from "$newdom1 = $proc1->transformToDoc($inputdom1)"

    php code is given below


    Code:
    <?php
    
    /* load the xml file and stylesheet as domdocuments */
    $xsl = new DomDocument();
    $xsl->load("rs.xsl");
    $inputdom = new DomDocument();
    $inputdom->load("rss.xml");
    
    /* create the processor and import the stylesheet */
    $proc = new XsltProcessor();
    $xsl = $proc->importStylesheet($xsl);
    $proc->setParameter(null, "titles", "WHOLESALE");
    
    /* transform and output the xml document */
    $newdom = $proc->transformToDoc($inputdom);
    print $newdom->saveXML($title);
    
    
    echo $title;
    
    $xsl1 = new DomDocument();
    $xsl1->load("des.xsl");
    $inputdom1 = new DomDocument();
    $inputdom1->load("rss.xml");
    
    /* create the processor and import the stylesheet */
    $proc1 = new XsltProcessor();
    $xsl1 = $proc1->importStylesheet($xsl1);
    $proc1->setParameter(null, "titles", "WHOLESALE");
    
    /* transform and output the xml document */
    $newdom1 = $proc1->transformToDoc($inputdom1);
    print $newdom1->saveXML($description);
    
    
    
    
    ?>






    how to write the values of $newdom and $newdom1 to a file parallely



    my output shouls be like this



    Code:
    <graph caption='WHOLESALE-REPORT' xAxisName='itemname' yAxisName='price' numberprefix='$' palette='3'  showValues='0' formatNumberScale='0' showBorder='1'>
    	<set name='XTPNR' value='181.5848' color='105682' />
    	<set name='XTPNR1' value='126.514' color='b4664' />
    <set name='XTPNR2' value='99.5982' color='163aee' />
    <set name='XTPNR3' value='35.7532' color='1b5f5a' />
    <set name='XTPNR4' value='99.5982' color='126542' />
    <set name='XTPNR5' value='79.1678' color='19d33a' />
    <set name='XTPNR6' value='125.1362' color='1a200f' />
    <set name='XTPNR7' value='116.0952' color='132288' />
    <set name='XTPNR8' value='4.4652' color='b8cdb' />
    <set name='XTPNR9' value='71.5064' color='1468f2' />
    <set name='XTPR0' value='1504.7724' color='1a4509' />
    <set name='XXABK2' value='7.442' color='1cd11c' />
    <set name='XXABK20' value='83.3504' color='123ad4' />
    <set name='XXABK3' value='111.0903' color='f085d' />
    <set name='XXABK4' value='83.3504' color='b2582' />
    <set name='XXABK5' value='66.978' color='171463' />
    <set name='XXABK6' value='128.0024' color='c5e96' />
    <set name='XXABK7' value='71.5064' color='13ff7a' />
    <set name='XXABK8' value='724.0023' color='11bb3b' />
    <set name='XXABK9' value='580.9895' color='1113c8' />
    </graph>
    Last edited by Atli; Feb 19 '10, 09:42 AM. Reason: Added [code] tags.
  • kovik
    Recognized Expert Top Contributor
    • Jun 2007
    • 1044

    #2
    XSLTProcessor:: transformToXML( ) returns a string. That means that $newdom and $newdom1 do not have a "saveXML()" function. They are strings.

    XSLTProcessor:: importStyleshee t() returns void. That means that there is no reason to be setting $xsl and $xsl1 to be equal to this value. It is void.

    I'm not going to go any further. I can see that your problem most likely lies in not reading through the documentation correctly. Take a look at the documentation for the classes that you are using, and then give it another shot.

    Comment

    • sisu
      New Member
      • Feb 2010
      • 16

      #3
      Thanks for u r reply

      i got the code working

      Comment

      Working...