XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 28th, 2004, 05:55 PM
PeterKay PeterKay is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 50 PeterKay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 58 sec
Reputation Power: 5
document() with missing files

im using document() to link to related xml files. The problem i am having is when one of the linked documents is missing.

What i wanted to do was have a copy of the seperated related documents on cd so they still worked (just with the related bits missing) without needing to modify the xsl file.

Is there a way in xsl to check if a file exists before trying to open it for information?

Reply With Quote
  #2  
Old July 29th, 2004, 11:23 AM
PeterKay PeterKay is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 50 PeterKay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 58 sec
Reputation Power: 5
ok i think im on to a possible solution but im still getting a lot of errors.

Here is the idea:

Put the information i want to display (linked to the alternative xml file) in a variable.

Use an if condition with fallback so if the fallback is used then the variable is changed so it no longer links to the other xml file

Display the variable.

Now the problems i am having are that i cannt seem to get variables working (ive not really messed with this much) and more importantly, fallback does not work at all if its used with document() for some reason. Ive searched on google for help regarding this but from what ive found fallback should work.

Code:
<xsl:if test="document(file)">
<xsl:fallback>
The file does not exist
</xsl:fallback>
</xsl:if>


The way im testing this is to run the xml with the folders im linking to renamed (add an extra random letter). The system works fine if they are named properly but i still get the usual errors if they are renamed (rather than the code in the fallback)

any ideas what im doing wrong?

Reply With Quote
  #3  
Old July 30th, 2004, 09:00 PM
PeterKay PeterKay is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 50 PeterKay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 58 sec
Reputation Power: 5
I think ive made some progress with the problem, with the following:
Code:
<xsl:variable name="test" select="c:/file.xml"/>
<td><xsl:value-of select="$test"/></td>
<xsl:choose>
<xsl:when test="boolean(document(string(concat('', $test, ''))))">
working
</xsl:when>
<xsl:otherwise>
not working
</xsl:otherwise>
</xsl:choose>


IE displays a The XML page cannot be displayed error and stops. If i use mozilla then the code works fine.

I would use mozilla now instead but i found that mozilla does not follow xml links on a php page (unless i copy the shortcut and paste into address bar).

Is there a way to turn of the XML errors in IE so it works like in mozilla? (or make mozilla work with XML links properly)

Reply With Quote
  #4  
Old July 31st, 2004, 02:22 PM
PeterKay PeterKay is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 50 PeterKay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 58 sec
Reputation Power: 5
i sorted the xml links in mozilla, it was relating to a security issue.

To turn this off i went to about:config, found security.checkloaduri and changed its value from true to false

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > document() with missing files


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT