Jump to content

unvoider

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by unvoider

  1. I'm still working on this. Any ideas? pointers? or someone that has done this before perhaps know of a way?

     

    I am trying something like this:

    //Loop through the form collection
    foreach($_POST as $key => $value){
    if ($value == 'Array') { 
    	for ($i=0; $i<count($value); $i++){
    		echo extract($value[$i]);
    		echo "<br>";
    	}
    }
    echo $key.": ".$value;
    echo "<br>";
    }
    //
    $extracted = extract($_POST);

     

    But I am having problems with sub-tree nodes because they are put into an array which doesn't seem to get passed from one page to another.

  2. Hello PHP Freak world,

     

    I am trying to do exactly this: http://www.w3schools.com/Xsl/xsl_editxml.asp which uses ASP but I want to use PHP.

     

    So far I am able to load an XML file into HTML and make a form but I am not sure how to have it take all the fields from the form and make it an XML file again.

     

    Here is a snippet of how I am able to load the XML file into an HTML form:

    <?php
                // Load XML file
                $XML = new DOMDocument();
                $XML->loadXML( $theData );
                
                // Start xslt
                $xslt = new XSLTProcessor();
                $XSL = new DOMDocument();
                $XSL->load( $XSLpath, LIBXML_NOCDATA);
                $xslt->importStylesheet( $XSL );
                
                // Print 
                print $xslt->transformToXML( $XML ); 
                ?>
    

     

    My XSL file looks like this:

    <!-- Host 1 -->
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/NAME">
    <tr><td>HOST_1</td>
    <td>NAME</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/NAME" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IP_ADDRESS">
    <tr><td></td>
    <td>IP_ADDRESS</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IP_ADDRESS" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/OS">
    <tr><td></td>
    <td>OS</td>
    <td class="col3"><input type="text" style="width:100%" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/OS" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IO/HOTADD_DIR">
    <tr><td></td>
    <td>HOTADD_DIR</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IO/HOTADD_DIR" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IO/SMUTIL_DIR">
    <tr><td></td>
    <td>SMUTIL_DIR</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IO/SMUTIL_DIR" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IO/SMASH_EXE">
    <tr><td></td>
    <td>SMASH_EXE</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/IO/SMASH_EXE" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_1']/HBA_PORT[@RefName='HBA_PORT_1']/NAME">
    <tr ID="HBAid0" span="3" style="display:none;"><td></td>
    <td>HBA_1 NAME</td>
    <td ID="td1" class="col3">
    <input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_1']/HBA_PORT[@RefName='HBA_PORT_1']/NAME" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_1']/HBA_PORT[@RefName='HBA_PORT_1']/WWN">
    <tr ID="HBAid1" span="3" style="display:none;"><td></td>
    <td>HBA_1 WWN</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_1']/HBA_PORT[@RefName='HBA_PORT_1']/WWN" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_2']/HBA_PORT[@RefName='HBA_PORT_1']/NAME">
    <tr ID="HBAid2" span="3" style="display:none;"><td></td>
    <td>HBA_2 NAME</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_2']/HBA_PORT[@RefName='HBA_PORT_1']/NAME" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    
    <xsl:for-each select="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_2']/HBA_PORT[@RefName='HBA_PORT_1']/WWN">
    <tr ID="HBAid3" span="3" style="display:none;"><td></td>
    <td>HBA_2 WWN</td>
    <td class="col3"><input type="text" style="width:100%;" name="TEST_CONFIGURATION/HOST[@RefName='HOST_1']/HBA[@RefName='HBA_2']/HBA_PORT[@RefName='HBA_PORT_1']/WWN" >
    <xsl:attribute name="id">
      <xsl:value-of select="." />
    </xsl:attribute>
    <xsl:attribute name="value">
      <xsl:value-of select="." />
    </xsl:attribute>
    </input> 
    </td>
    </tr>
    </xsl:for-each>
    

     

    Any help, ideas, input or anything comments about doing this would be greatly appreciated.

     

    thank you for your help,

    Unvoider

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.