Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 2nd, 2007, 06:29 AM
Authorized User
 
Join Date: Sep 2006
Location: , , .
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?

Reply With Quote
  #2 (permalink)  
Old January 2nd, 2007, 06:47 AM
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

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
Reply With Quote
  #3 (permalink)  
Old January 3rd, 2007, 08:39 AM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nadavvin
Default

thanks it work.

Reply With Quote
  #4 (permalink)  
Old June 10th, 2007, 07:55 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
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

Reply With Quote
  #5 (permalink)  
Old June 10th, 2007, 09:25 AM
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

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:36 PM.


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