title: Getting the following sibling in an XPath when "following" axis is not supported
body: <p>I am trying to get the text elements of a table that follows a paragraph that contains a specific text element using XQuery on MS SQL Server.  The problem is whenever I use the axes "following", "following-sibling" or "previous-sibling", I get an error saying this is not supported in SQL Server (I'm using version 2008).  So for instance, I can get the first paragraph node that contains a text node whose value is "blah":</p>
  
  <pre><code>//w:p[descendant::w:t = "blah"]
  </code></pre>
  
  <p>And I can get the text from a table element using:</p>
  
  <pre><code>//w:tbl//w:t/text()
  </code></pre>
  
  <p>I don't see any way I can force the query to only return the first table element that follows the previously captured paragraph node since:</p>
  
  <pre><code>//w:tbl[following:://w:p//w:t = "blah"]//w:t/text()
  </code></pre>
  
  <p>Gives the error: "XQuery [Specification.document.query()]: The XQuery syntax 'following' is not supported."</p>
  
  <p>And the same for:</p>
  
  <pre><code>//w:tbl[following-sibling::w:p[descendant::w:t = "blah"]]//w:t/text()
  </code></pre>
  
  <p>Gives "XQuery [Specification.document.query()]: The XQuery syntax 'following-sibling' is not supported."</p>
  
  <p>That ain't right, y'all know!  XPath has supported following and following-sibling since 1.0 back in 1999 AFAICT so MS SQL Server seems to be severely deficient in terms of standard compliance but either way, does anyone see a way I can do this without those axes?  Thanks in advance!</p>