Topic
3 replies Latest Post - ‏2012-10-12T12:02:51Z by SystemAdmin
SystemAdmin
SystemAdmin
6772 Posts
ACCEPTED ANSWER

Pinned topic How to ignore errors inside stylesheet?

‏2012-10-10T09:16:51Z |
Hi,

I am using dp:decode function inside my stylesheet,if i send invalid bse-64 encoded value in the request it's failing in the dp:decode function as expected but my requirement is to ignore the particular error and continue normal processing,even though am using on-error action before that action with continue mode it's not working.

Is there any way to ignore particular errors inside a stylesheet and continue normal processing? please help me ASAP.

Thanks in adv.
Updated on 2012-10-12T12:02:51Z at 2012-10-12T12:02:51Z by SystemAdmin
  • sachinRocks
    sachinRocks
    3 Posts
    ACCEPTED ANSWER

    Re: How to ignore errors inside stylesheet?

    ‏2012-10-11T10:19:49Z  in response to SystemAdmin
    Try assigning the output of decode() directly to a local variable.
    • HermannSW
      HermannSW
      4242 Posts
      ACCEPTED ANSWER

      Re: How to ignore errors inside stylesheet?

      ‏2012-10-11T12:29:45Z  in response to sachinRocks
      A "dp:decode(..., 'base-64')" error cannot be masked, and always terminates stylesheet execution.

      The only "test whether dp:decode(..., 'base-64') would work" I know of is "validate-base64()" function from binaryNode.xsl attached in this posting:
      https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14896430#14896430

      Have your stylesheet do
      <xsl:import href="binaryNode.xsl"/>

      then
      <xsl:value-of select="dp:validate-base64('dGVzdAo=')"/>
      <xsl:value-of select="dp:validate-base64('dGUAdA==')"/>

      will return "true" and "false".

      dp:validate-base64($base64string)
      • converts $base64string to hex
      • validates the hex string against "concat('^(',$UTF-8_char,')*$')" regular expression
      • with $UTF-8_char and $ASCII_char being defined according the spec http://www.w3.org/TR/REC-xml/#charsets:
      
      <xsl:variable name=
      "ASCII_char" select=
      "'09|0A|0D|[2-6][0-9A-F]|7[0-9A-E]'" />   <xsl:variable name=
      "UTF-8_char" select=
      "concat( $ASCII_char, 
      '|C[2-9A-F][89AB][0-9A-F]|D[0-9A-F][89AB][0-9A-F]', 
      '|E[AB][0-9A-F][89AB][0-9A-F]', 
      '|E[1-9A-CEF][89AB][0-9A-F][89AB][0-9A-F]', 
      '|ED[89][0-9A-F][89AB][0-9A-F]', 
      '|F0[9AB][0-9A-F][89AB][0-9A-F][89AB][0-9A-F]', 
      '|F[1-3][89AB][0-9A-F][89AB][0-9A-F][89AB][0-9A-F]', 
      '|F48[0-9A-F][89AB][0-9A-F][89AB][0-9A-F]' )
      " />
      


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

    Re: How to ignore errors inside stylesheet?

    ‏2012-10-12T12:02:51Z  in response to SystemAdmin
    Thanks for the response and for the work around