Topic
3 replies Latest Post - ‏2012-11-01T15:29:31Z by HermannSW
SystemAdmin
SystemAdmin
6772 Posts
ACCEPTED ANSWER

Pinned topic Can I skip a transformation action in the policy by exiting the xslt??

‏2012-11-01T04:48:40Z |
Hi all,

I'm new to Datapower. I have to exit the execution of an xslt which will be used in the next transformation action of my policy.
How can I do this??

Thanks in advance for any help provided

Regards,
Komala G
Updated on 2012-11-01T15:29:31Z at 2012-11-01T15:29:31Z by HermannSW
  • HermannSW
    HermannSW
    4252 Posts
    ACCEPTED ANSWER

    Re: Can I skip a transformation action in the policy by exiting the xslt??

    ‏2012-11-01T08:53:19Z  in response to SystemAdmin
    Hi,

    if you just want to stop execution of the policy AFTER the stylesheet has completed, use <dp:reject ...>.
    If you want to stop execution inside a stylesheet IMMEDIATELY, use <dp:reject ...> together with <xsl:message terminate="yes">.

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    • SystemAdmin
      SystemAdmin
      6772 Posts
      ACCEPTED ANSWER

      Re: Can I skip a transformation action in the policy by exiting the xslt??

      ‏2012-11-01T11:15:56Z  in response to HermannSW
      Thanks Herman. I just want to stop the execution of my next action in the policy(which is conditional action).
      Can I do it using a xslt???

      Regards,
      Komala G
      • HermannSW
        HermannSW
        4252 Posts
        ACCEPTED ANSWER

        Re: Can I skip a transformation action in the policy by exiting the xslt??

        ‏2012-11-01T15:29:31Z  in response to SystemAdmin
        > Can I do it using a xslt???
        >
        Yes, just use stylesheet "reje.xsl" as basis:
        $ echo "<msg>test123</msg>" | coproc2 reje.xsl - http://dp3-l3:2223 ; echo
        <?xml version="1.0" encoding="UTF-8"?>
        <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>test123 (from client)</faultstring></env:Fault></env:Body></env:Envelope>
        $ 
        $ cat reje.xsl 
        <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"
        >
        <xsl:output omit-xml-declaration="yes" />
         
          <xsl:template match="/">
            <dp:reject><xsl:value-of select="."/></dp:reject>
          </xsl:template>
         
        </xsl:stylesheet>
        $
        


        Hermann <myXsltBlog/> <myXsltTweets/>
        Updated on 2014-03-25T02:46:24Z at 2014-03-25T02:46:24Z by iron-man