Topic
5 replies Latest Post - ‏2013-03-21T11:13:22Z by smashyrahul
smashyrahul
smashyrahul
356 Posts
ACCEPTED ANSWER

Pinned topic 7: Operator expected

‏2013-03-20T17:01:14Z |
Hello Experts,

I am using the xslt stylesheet in filter action. While processing I am getting below error in "error-message" service variable.

Fatal Error at local:test.xsl:7: Operator expected

Is there anything wrong with the code below?

below is the stylesheet that I am using in this case.

<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp" exclude-result-prefixes="dp">
<xsl:output method="xml" />
<xsl:template match="/">

<xsl:variable name="var1" select="/*/*/*/*"/>

<xsl:variable name="var2" select="/*/*/*/*"/>

<xsl:if test="$var1= 'some string' and $quote-or-print != 'some string'">
<dp:reject>error message</dp:reject>
</xsl:if>

</xsl:template>
</xsl:stylesheet>

Thanks,
Rahul
Updated on 2013-03-21T11:13:22Z at 2013-03-21T11:13:22Z by smashyrahul
  • kenhygh
    kenhygh
    1308 Posts
    ACCEPTED ANSWER

    Re: 7: Operator expected

    ‏2013-03-20T20:32:47Z  in response to smashyrahul
    well, right off, $quote-or-print isn't defined anywhere.
    • smashyrahul
      smashyrahul
      356 Posts
      ACCEPTED ANSWER

      Re: 7: Operator expected

      ‏2013-03-20T21:01:02Z  in response to kenhygh
      Hi Ken,

      That I had already corrected...actually that is not the cause of the issue..below is the corrected code...but I am still getting the same error..is there something wrong with the way I am using "and" operator??

      <?xml version="1.0" encoding="UTF-8" ?>

      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp" exclude-result-prefixes="dp">
      <xsl:output method="xml" />
      <xsl:template match="/">

      <xsl:variable name="var1" select="/*/*/*/*"/>

      <xsl:variable name="var2" select="/*/*/*/*"/>

      <xsl:if test="$var1= 'some string' and $var2 != 'some string'">
      <dp:reject>error message</dp:reject>
      </xsl:if>

      </xsl:template>
      </xsl:stylesheet>

      Thanks,
      Rahul
      • HermannSW
        HermannSW
        4155 Posts
        ACCEPTED ANSWER

        Re: 7: Operator expected

        ‏2013-03-21T00:03:58Z  in response to smashyrahul
        Your first stylesheet had a compile error.
        The 2nd (attached) is totally OK, no compile error.

         
        Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

        Attachments

        • smashyrahul
          smashyrahul
          356 Posts
          ACCEPTED ANSWER

          Re: 7: Operator expected

          ‏2013-03-21T10:12:07Z  in response to HermannSW
          Hi Hermann,

          Yes, there are no compilation errors, but still datapower is throwing "operator expected" error...not sure why..

          Can I have some different approach to this?
          Thanks,
          Rahul
          • smashyrahul
            smashyrahul
            356 Posts
            ACCEPTED ANSWER

            Re: 7: Operator expected

            ‏2013-03-21T11:13:22Z  in response to smashyrahul
            Hi All,

            My issue has been resolved now. There were minor compilation errors in the stylesheet that I had uploaded in datapower filesystems

            Thanks all for your help!!!

            Rahul