PHP (XPath / XSL) and Web Form Help Needed.

Soldato
Joined
12 Sep 2003
Posts
11,213
Location
Newcastle, UK
Hi all,

I need some help with a website search page I'm building please. :)

I'm a little confused. The problem is that basically I have a drop down list which is populated from a .xml document. For example, something like this:-

Type of Car :- <Ford, VW, etc etc>

However, say there were the Car Types, but each had a child of differing engine size. What I would want is for someone to select the car type hit "SUBMIT" and a list of the Engine types to be displayed in a Table all relating to that one make selected earlier.

At the moment what happens, is that I have multiple car types listed, i.e.

Type of Car :- <Ford, Ford, Ford, VW, etc etc>

(The multiple entry relating to the various engine sizes).

:(

I can't seem to figure out how to remove the duplicate entries from being listed in the drop down list. I did find this piece of code, but I can't seem to integrate it with the <Form></Form> part.

Code:
<!-- xq495.xsl: converts xq494.xml into xq496.xml -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     version="1.0">
  <xsl:output method="xml" omit-xml-declaration="yes"/>

  <xsl:template match="line">
    <xsl:if test="not(. = preceding::line)">
      <xsl:copy>

        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:if>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>

      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>
(http://www.xml.com/pub/a/2002/10/02/tr.html)

Apparently, that goes through and removes the entry if it's already listed.

Any help or pointers would be appreciated!! ;)
 
Back
Top Bottom