Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 8th, 2006, 04:50 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default check presence of <?xml version="1.0">

How to write xsl code which checks that xml file starts with following:

<?xml version="1.0" encoding="UTF-8"?>

The file which does not start with above line is invalid xml file.

How to write the xsl code to check the above mentioned validation.
Someone please help.

HV
  #2 (permalink)  
Old June 8th, 2006, 05:24 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I don't think this is possible, that information is lost by the time the XSLT gets its hands on the XML document.
Why do you care?

--

Joe (Microsoft MVP - XML)
  #3 (permalink)  
Old June 8th, 2006, 04:54 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The XML declaration is not part of the tree model passed by the XML parser to the XSLT processor.

XSLT can only be used to process well-formed XML documents. If the document isn't well-formed (that is, if it isn't XML), then XSLT is no use to you.

(However, you are wrong to suppose that an XML file with no XML declaration cannot be well-formed)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check for the presence of an attribute dsekar_nat XSLT 2 July 27th, 2006 05:04 AM
check all checkboxes with a <td> onClick event crmpicco Javascript How-To 1 August 19th, 2005 09:17 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
HELP HELP ODBC<->ASP <-> XML moon Wrox Book Feedback 1 November 9th, 2003 12:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.