Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old January 2nd, 2007, 06:29 AM
Authorized User
 
Join Date: Sep 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nadavvin
Default How do I transform XSLT without the <?xml?> tag?

When I transform xml with PHP, it always add the <?xml version="1.0"?>.

Can I solve it from the XSLT file itself?

 
Old January 2nd, 2007, 06:47 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Try omit-xml-declaration="yes" in the xsl:output declaration.

Note however that if you use any output encoding other than UTF-8 or UTF-16, your output document MUST include an XML declaration if it is to be well-formed XML.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 3rd, 2007, 08:39 AM
Authorized User
 
Join Date: Sep 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nadavvin
Default

thanks it work.

 
Old June 10th, 2007, 07:55 AM
Authorized User
 
Join Date: Jun 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I have the same problem when outputting text files and the omit-xml-declaration doesn't work.
Here is my output tag :

<xsl:output
    method="text"
    indent="no"
    omit-xml-declaration="yes"
    name="GML"/>

i have always in the resulting file : <?xml version="1.0" encoding="UTF-8"?> before my text
I have the latest version of saxon.

Thanks

 
Old June 10th, 2007, 09:25 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You should never get an XML declaration when you output using method="text".

One possible explanation is that the XSLT processor isn't doing the serialization - perhaps you are writing the output to a DOM, and then serializing using the DOM serializer.

But I notice that your xsl:output specifies name="GML", so it will only affect output written using <xsl:result-document format="GML">.

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
<?javax.xml.transform.disable-output-escaping ?> robbert XSLT 5 January 5th, 2011 07:28 PM
<a> tag in XML sani723 XSLT 5 March 27th, 2007 04:16 AM
How to insert <META> tag using XSLT on client? Abdul Hameed XSLT 2 September 19th, 2004 12:24 PM
How to insert <META> Tag using XSLT on client Abdul Hameed XML 0 August 10th, 2004 11:34 PM
XML to (different <tag>) XML mapping Thodoris XML 4 April 27th, 2004 04:02 AM





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