Solved

XSLT process empty file

Posted on 2013-10-28
3
295 Views
Last Modified: 2013-10-29
Hello Experts,
Can we process empty file using XSLT..

I want to transform a empty file to this output below:

<DynamicValidationValueChanges dynamicValidationId="String" xsichemaLocation="_http://integration.cbre.com/schemas/gcs/intrepid/tsdynamicvalidation/v1 integration.cbre.com.schemas.gcs.intrepid.tsdynamicvalidation.v1.xsd" xmlns="_http://integration.cbre.com/schemas/gcs/intrepid/tsdynamicvalidation/v1" xmlns:xsi="_http://www.w3.org/2001/XMLSchema-instance"/>


Any Idea?

Thanks
0
Comment
Question by:mani_sai
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 39606831
well, why process an known to be empty file using XSLT?
Test the string content of the source, and when empty dump the expected result

Anyhow, XSLT requires a wellformed XML document as the source,
a wellformed XML documents has to the least exactly one root element
so an empty file can not serve as the source of an XSLT

Using XSLT2 you can indicate a starting template (has to be a named template)
but still you have to work around to cover both empty files and XML files,
so you are better off to deal with empty document logic outside the XSLT

I usually try to get the process generating the XML output at least an empty root element, so can easily cover teh required logic in pure XSLT terms
0
 
LVL 8

Author Comment

by:mani_sai
ID: 39608695
Thanks
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39608809
welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now