XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 22nd, 2003, 01:54 PM
rnsavvy rnsavvy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 10 rnsavvy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
XSLT outputing <?xml> and <!DOCTYPE>

I'm using XSLT to transform XML data into XHTML, but I need to output the xml declaration and the doctype before the <html> tag...

<xsl:template match="/">
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//OPENWAVE//DTD XHTML Mobile 1.0//EN" "http://www.openwave.com/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

...
</xsl:template>

How can I have these included in my code? Currently they cause errors.

Reply With Quote
  #2  
Old July 22nd, 2003, 02:11 PM
mrusaw's Avatar
mrusaw mrusaw is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Dallas, Texas
Posts: 138 mrusaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to mrusaw Send a message via Yahoo to mrusaw
i believe it has to go in the xsl:output element which must appear as the child node of the xsl:stylesheet element. I hope this helps.

Code:
<xsl:output method="xml" encoding="iso-8859-1"
  doctype-system="http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd";
  doctype-pubilc="-//W3C//DTD XHTML 1.0 Strict//EN"/>

Reply With Quote
  #3  
Old July 22nd, 2003, 02:32 PM
rnsavvy rnsavvy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 10 rnsavvy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
So it is not possible to have the following outputted by my XSL? The above example would probably take care of the doctype, but what about the <?xml version="1.0"?>


<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//OPENWAVE//DTD XHTML Mobile 1.0//EN" "http://www.openwave.com/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
...
</html>

Reply With Quote
  #4  
Old July 22nd, 2003, 02:39 PM
mrusaw's Avatar
mrusaw mrusaw is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Dallas, Texas
Posts: 138 mrusaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to mrusaw Send a message via Yahoo to mrusaw
you could out put it but i am not sure that it will not give unexpected results. typically the "processor directive" is the first line in your xsl page. something like what you have. It is basically a statement that says "hello I ma a xml file... process me!" Then the stylesheets requires everything to be placed inside the <xsl:stylesheet> element for transformation.

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

Reply With Quote
  #5  
Old July 30th, 2003, 12:33 AM
mulligh mulligh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 19 mulligh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This is controlled by the "omit-xml-declaration" attribute, which is generally set by "no" by default. If your output method is "xml" then it should automatically output the declaration. If it doesn't, try adding omit-xml-declaration="no" to the <xsl:output> element.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSLT outputing <?xml> and <!DOCTYPE>


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway