title: XPath expression for parsing XML based on more than one values?
body: <p>Here is where I'm stuck (have a look at the files below to getter a better picture) :</p>
  
  <pre><code>value.singleNodeValue.setAttribute("select", "books/scifi[year&gt;1962]");
  </code></pre>
  
  <p>How can I add more "filters" to the above? for example: <code>[year&gt;1962 &amp;&amp; author=Dan Larson]</code> I know this isn't the correct syntax because it's not working so how do I do it? </p>
  
  <p>XML file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="books.xsl"?&gt;
  &lt;!DOCTYPE books [
  &lt;!ENTITY Aring  "&amp;amp;#197;" &gt;
  &lt;!ENTITY aring  "&amp;amp;#229;" &gt;
  &lt;!ENTITY agrave "&amp;amp;#224;" &gt;
  &lt;!ENTITY aacute "&amp;amp;#225;" &gt;
  &lt;!ENTITY auml   "&amp;amp;#228;" &gt;
  &lt;!ENTITY ccedil "&amp;amp;#231;" &gt;
  &lt;!ENTITY eacute "&amp;amp;#233;" &gt;
  &lt;!ENTITY egrave "&amp;amp;#232;" &gt;
  &lt;!ENTITY iacute "&amp;amp;#237;" &gt;
  &lt;!ENTITY iuml   "&amp;amp;#239;" &gt;
  &lt;!ENTITY oacute "&amp;amp;#243;" &gt;
  &lt;!ENTITY ocirc  "&amp;amp;#244;" &gt;
  &lt;!ENTITY oslash "&amp;amp;#248;" &gt;
  &lt;!ENTITY Ouml   "&amp;amp;#214;" &gt;
  &lt;!ENTITY ouml   "&amp;amp;#246;" &gt;
  &lt;!ENTITY uuml   "&amp;amp;#252;" &gt;
  ]&gt;
  
  &lt;books&gt;
  
    &lt;scifi key="DanlarsC83"&gt;
      &lt;shelfcode&gt;scif/all/83&lt;/shelfcode&gt;
      &lt;author&gt;Dan Larson&lt;/author&gt;,
      &lt;author&gt;James Roberts&lt;/author&gt;,
      &lt;author&gt;Chris Rupert&lt;/author&gt;,
      &lt;title&gt;The Game&lt;/title&gt;,
      &lt;pages&gt;126-212&lt;/pages&gt;,
      &lt;year&gt;1965&lt;/year&gt;,
      &lt;booktitle&gt;SCI&lt;/booktitle&gt;,
    &lt;/scifi&gt;
  
    &lt;scifi key="RobDwightS45"&gt;
      &lt;shelfcode&gt;scif/all/45&lt;/shelfcode&gt;
      &lt;author&gt;Dan Larson&lt;/author&gt;,
      &lt;author&gt;Christine Dwight&lt;/author&gt;,
      &lt;title&gt;Hopes&lt;/title&gt;,
      &lt;pages&gt;113-242&lt;/pages&gt;,
      &lt;year&gt;1973&lt;/year&gt;,
      &lt;booktitle&gt;SCI&lt;/booktitle&gt;,
    &lt;/scifi&gt;
  
    &lt;scifi key="MarkJohnsC52"&gt;
      &lt;shelfcode&gt;scif/all/52&lt;/shelfcode&gt;
      &lt;author&gt;Dan Larson&lt;/author&gt;,
      &lt;title&gt;Incognitum&lt;/title&gt;,
      &lt;pages&gt;131-420&lt;/pages&gt;,
      &lt;year&gt;1949&lt;/year&gt;,
      &lt;booktitle&gt;SCI&lt;/booktitle&gt;,
    &lt;/scifi&gt;
  
   &lt;/books&gt;
  </code></pre>
  
  <p>XSL file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
    &lt;body&gt;
      &lt;center&gt;&lt;h1&gt;TOM's Sci-Fi&lt;/h1&gt;
      &lt;table border="1"&gt;
      &lt;tr&gt;
        &lt;th&gt;Title&lt;/th&gt;
        &lt;th&gt;Authors&lt;/th&gt;
        &lt;th&gt;Pages&lt;/th&gt;
        &lt;th&gt;Year&lt;/th&gt;
      &lt;/tr&gt;
        &lt;xsl:for-each select="books/scifi"&gt;
        &lt;xsl:sort select="year"/&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;center&gt;&lt;xsl:value-of select="title"/&gt;&lt;/center&gt;&lt;/td&gt;
        &lt;td&gt;
         &lt;xsl:for-each select="author"&gt;
          &lt;p&gt;&lt;xsl:value-of select="."/&gt;&lt;/p&gt;
          &lt;/xsl:for-each&gt;
        &lt;/td&gt; 
        &lt;td&gt;&lt;xsl:value-of select="pages"/&gt;&lt;/td&gt;
        &lt;td&gt;&lt;xsl:value-of select="year"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/xsl:for-each&gt;
      &lt;/table&gt;
      &lt;/center&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>HTML file:</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;script type="text/javascript"&gt;
  
  var moz = (typeof document.implementation.createDocument != 'undefined');
  var ie =  (typeof window.ActiveXObject != 'undefined');
  
  function loadXML(file)
  {
    var xmlDoc;
    if (moz)
      xmlDoc = document.implementation.createDocument("", "", null);
    else if (ie)
      xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
    xmlDoc.validateOnParse=false;
    xmlDoc.load(file);
    return xmlDoc;
  }
  &lt;/script&gt;
  
  &lt;body id="target4"&gt;
  &lt;script type="text/javascript"&gt;
  
   function filterTable(f)
  
  
  {
    var xmlDoc = loadXML("books.xml");
    var stylesheet = loadXML("books.xsl");
    var moz = (typeof document.implementation.createDocument != 'undefined');
    var ie = (typeof window.ActiveXObject != 'undefined');
  
    if (moz)
    {
      var nsResolver = stylesheet.createNSResolver( stylesheet.ownerDocument == null ? stylesheet.documentElement : stylesheet.ownerDocument.documentElement);
  
      var value = stylesheet.evaluate("//xsl:template[@match='/']//xsl:for-each", stylesheet, nsResolver, XPathResult.ANY_UNORDERED_NODE_TYPE, null);
  
      var author = document.getElementById("inauthor").value;
      var title = document.getElementById("intitle").value;
      var year = document.getElementById("inyear").value;
      var filter = "";
  
      if (author != "")
      {
         filter= filter + "author='" + author.substr(1) + "'";
      }
  
      if (title != "")
      {
          if (filter != "") filter = filter + " and ";
          filter = filter + "title='" + title.substr(1) + "'";
      }
  
      if (year != "")
      {
          if (filter != "") filter = filter + " and ";
          filter = filter + "year" + year.substr(0) + year.substr(1);
      }
  
      value.singleNodeValue.setAttribute("select", "books/scifi[filter]");
  
      var proc = new XSLTProcessor();
      proc.importStylesheet(stylesheet);
      var resultFragment = proc.transformToFragment(xmlDoc, document);
      document.getElementById("target4").appendChild(resultFragment);
    }
  
    else if (ie)
    {
  
      var value = stylesheet.selectSingleNode("//xsl:template[@match='/']//xsl:for-each");
  
      value.setAttribute("select", "books/scifi[filter]");
  
      document.write(xmlDoc.transformNode(stylesheet));
    }
    }
  
  &lt;center&gt;
    &lt;table border="1" cellpadding="8"&gt;
    &lt;tr&gt;&lt;td&gt;
    &lt;/br&gt;
      &lt;form&gt;
        &lt;center&gt;
          &lt;b&gt; search by &lt;/b&gt;
          Author(s): &lt;input type="text" name="authors" /&gt;
          Title: &lt;input type="text" name="title" /&gt;
          Year: &lt;input type="text" name="year" /&gt;
          No of Authors: &lt;input type="text" name="numauth" /&gt;
          &lt;/br&gt;&lt;/br&gt;
          &lt;b&gt; sort by&lt;/b&gt;
          &lt;input type="radio" name="sorter" value="author" /&gt;author
          &lt;input type="radio" name="sorter" value="title" /&gt;title
          &lt;input type="radio" name="sorter" value="year" /&gt;year
          &lt;input type="radio" name="sorter" value="pages" /&gt;pages&lt;/br&gt;&lt;/br&gt;
          &lt;input type="button" value="Display" onClick="filterTable(this.form)"/&gt;
       &lt;/center&gt;
      &lt;/form&gt;
     &lt;/td&gt;&lt;/tr&gt;
     &lt;/table&gt;
  &lt;/center&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>