RSS Forums RSS

Refresh XML/XSL fails because XML page being updated

Please support our XML, XSLT and XPATH advertiser: Programming Forums
Reply
Posts: 3
Reputation: davidi is an unknown quantity at this point 
Solved Threads: 0
davidi davidi is offline Offline
Newbie Poster

Refresh XML/XSL fails because XML page being updated

  #1  
Jan 8th, 2009
Hi,
I've tried to find an answer to this everywhere but to now avail....

I have an XML/XSL file that displays a webpage. The XSL has :
<!--Refresh the page every X seconds-->
<META http-equiv="Refresh">
<xsl:attribute name="content">
<xsl:value-of select="//PageRefreshOverride"></xsl:value-of>
</xsl:attribute>
</META>

because I want the page to refresh every few seconds. The XML file is being updated by a .NET application about every 30 seconds. So basically I want the application to update the XML page and the page to refresh every about 30 seconds also to show the changes.

My problem is that every so often the refresh happens at the exact second that the XML is being written and the file isn't complete yet. It then displays the error:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


Is there a way to fix this because the update stops and the page never restarts the refresh process again.

regards
Dave
AddThis Social Bookmark Button
Reply With Quote  
Posts: 79
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 4
fpmurphy fpmurphy is offline Offline
Junior Poster in Training

Re: Refresh XML/XSL fails because XML page being updated

  #2  
Jan 12th, 2009
You probably need to modify your application so that it does the transformation also and just sends HTML to the webpage.
Reply With Quote  
Posts: 3
Reputation: davidi is an unknown quantity at this point 
Solved Threads: 0
davidi davidi is offline Offline
Newbie Poster

Re: Refresh XML/XSL fails because XML page being updated

  #3  
Jan 12th, 2009
Thanks, but I can't really do that. The XSL needs to be available because the page must be easily configurable by the users. It doesn't sound like there is a nice answer to this so I'm going to change the App so it writes the XML out to a temp file and them does a simple file copy to the final location. This may limit the exposure to a half complete file.
Reply With Quote  
Posts: 79
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 4
fpmurphy fpmurphy is offline Offline
Junior Poster in Training

Re: Refresh XML/XSL fails because XML page being updated

  #4  
Jan 13th, 2009
Another possibility (untested) is for your App to create a lockfile while it is writing out the XML document and then remove the lockfile when the document write is completed. Within your XSL have a test to see if the lockfile exists and do nothing if it exists.
   <xsl:variable name="lockexists">
      <xsl:choose>
         <xsl:when test="document('/tmp/lockfile')">true</xsl:when>
         <xsl:otherwise>false</xsl:otherwise>
      </xsl:choose>
   </xsl:variable>
The lockfile should be a simple XML document with a different namespace so that document() does not complain.
Last edited by fpmurphy : Jan 13th, 2009 at 10:33 am.
Reply With Quote  
Posts: 3
Reputation: davidi is an unknown quantity at this point 
Solved Threads: 0
davidi davidi is offline Offline
Newbie Poster

Re: Refresh XML/XSL fails because XML page being updated

  #5  
Jan 13th, 2009
Ah Mr fpmurphy, very nice, I think that's a better solution. I'll do that, thanks for your help.
regards
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the XML, XSLT and XPATH Forum
Views: 764 | Replies: 4 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:16 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC