Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 807869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:28:16+00:00 2026-05-15T00:28:16+00:00

[Please edit the title if you find its not good enough] I have code

  • 0

[Please edit the title if you find its not good enough]

I have code which triggers XSL-transformation:

objMemoryStream = new MemoryStream();

xslTransform = new XslCompiledTransform();
xpathXmlOrig = new XPathDocument("E:\\xslt error\\Simulation_of_error\\input.xml");

xslSettings = new XsltSettings();
xslSettings.EnableScript = true;
xslTransform.Load(strXmlQueryTransformPath, xslSettings, new XmlUrlResolver());
xslTransform.Transform(xpathXmlOrig, null, objMemoryStream);
objMemoryStream.Position = 0;
StreamReader objStreamReader = new StreamReader(objMemoryStream);

The method xslTransform.Load(strXmlQueryTransformPath, xslSettings, new XmlUrlResolver()); is a victim, which fails some times due to some time-out issue.

I want to detect the failure of this codeline and execute again until it successfully executes!

I tried using “TRY CATCH and WHILE methods”:

bool flag = true;
do
{
    try
    {
        xslTransform.Load(strXmlQueryTransformPath, xslSettings, new XmlUrlResolver());
        flag = false;
    }
    catch
    {
        flag = true;
    }
} while (flag);

but the problem is “error is getting logged in the log file”, Well. The whole code is under one more try statement, which I suspect is writing to log. Which is what I don’t want… I don’t want end user to know about the failure of this codeline.

Is there anyway to get it done?

The appearance of error is completely Random. First time when it fails, I try to retrigger the code, which may result in the successful transformation (on next attempt)! This is the reason why I came to conclusion that recall of Load() method would fix the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:28:17+00:00Added an answer on May 15, 2026 at 12:28 am

    Did you try to remove the inline scripts and to pass an extension object to the transformation?

    I believe this will most probably solve the problem.

    Otherwise you should catch XsltException and its properties LineNumber and LinePosition give you the location in the code where the exception happened.

    Update: A simple example of writing an extension function (part of an extension object) passed to the transformation, and its usage within the XSLT transformation is provided here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did not find a better title if you have a better one please
Not sure if the title is correct, Please edit if you think of a
I'm not sure what kind of terminology to use in this so please edit
LATER EDIT: Please mention not only game programming books, but also more scientific/simulation oriented
Edit my code to make it work please. Edited for latest version. Here is
Please let me know if you have any idea about it. Thanks EDIT What
I'm not sure how to proper name the question. Please fell free do edit.
[Sorry for the title, I really didn't find a good one, if anyone has
I don't know how to explain this properly, someone please edit my title and
I have a button which is not working when placed below two panels. If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.