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

2
  • 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. Commented Apr 11, 2017 at 19:30
  • See Difference between “//” and “/” in XPath for a clear explanation the difference between // and /, but know that // would not cause an "invalid xpath expression" error. Commented Apr 13, 2017 at 17:32

1 Answer 1

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;.
Sign up to request clarification or add additional context in comments.

2 Comments

not working this script <xsl:if test='../z:row[postion() &gt 5]'>. Getting error like below "' ' is an unexpected token. The expected token is ';'. Line 45, position 43."
Well, like the error messages says, it expects to see a semicolon (;) after the &gt: &gt; is what I said to use; you cannot leave off the ;.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.