1

Actually, we are getting invalid xpath expression on loading xsl file. invalid xpath expression issue getting from below xsl script

    1. "<xsl:if test='z:row[index() $gt$ 5]'>"
    2. "<xsl:if test="//CICOUNT[@HASARCHIVE = 'Y' or @HASUNREVIEWED = 'Y']">"
    3. "<xsl:if test="//CICOUNT[@HASARCHIVE = 'Y' and @HASUNREVIEWED = 'N']">"
    4. "<xsl:template match="z:row[index() $lt$ 6]">"

Above issue we are getting because we modifying the old old Microsoft WD-xsl language which was introduced in IE4 in 1998.

Thanks in advance

  • In addition to @kjhughes post below, also note that the `//` in rules 2 and 3 mean that these will evaluate to `true` if **any** `CICOUNT` **anywhere in the file** has an attribute `HASARCHIVE` with a value of `Y`. This `//` notation appears to be a common cause of confusion. – Eiríkr Útlendi Apr 11 '17 at 19:30
  • See [**Difference between “//” and “/” in XPath**](http://stackoverflow.com/questions/43100052/difference-between-and-in-xpath) for a clear explanation the difference between `//` and `/`, but know that `//` would not cause an "invalid xpath expression" error. – kjhughes Apr 13 '17 at 17:32

1 Answers1

1

There are several issues with those XPath expressions, including

  • z namespace prefix may not have been declared, depending upon context.
  • index() is an unknown function; may want position() instead.
  • $gt$ and $lt$ are unknown operators; use &gt; and &lt;.
kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • not working this script ****. Getting error like below "' ' is an unexpected token. The expected token is ';'. Line 45, position 43." – MakDeveloper Apr 12 '17 at 10:02
  • Well, like the error messages says, it expects to see a semicolon (`;`) after the `&gt`: `>` is what I said to use; you cannot leave off the `;`. – kjhughes Apr 12 '17 at 16:58