Reputation: 14472
I have an file which will either be empty, or will contain a single line with a single string value.
I can consume the file contents in either an XPath expression evaluator or in an XSL transform, version 1.
I simply need to know if there is a value in the file or not.
As far as I know, both tools require correctly formed XML.
Do I have any options?
(It's a boring story about why I only have XPath or XSLT 1.0 available to me)
Upvotes: 2
Views: 162
Reputation: 111706
You're right that XPath and XSLT generally operate on well-formed XML, and an empty file is not well formed XML because it lacks a single root element.
XSLT 2.0, however, can read non-XML via unparsed-text()
. That's your ticket for exploring empty or any other text that's not well-formed XML using XSLT.
If you only have XSLT 1.0, then you're out of luck if you can't operate outside of XSLT 1.0 via preprocessing or using non-standard extensions.
Upvotes: 1