Solved

XSLT process empty file

Posted on 2013-10-28
3
293 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
Comment Utility
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
Comment Utility
Thanks
0
 
LVL 60

Expert Comment

by:Geert Bormans
Comment Utility
welcome
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

15 Experts available now in Live!

Get 1:1 Help Now