473,668 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting DOCTYPE and also including a file in the output

Hello,

I'm new to xml and xslt but that should be obvious from my question.

I'm trying to help my wife set up some web pages with some of her art
work and what I'm trying to do is find a way to get all of the
information about the pictures in an XML file and then use xslt to
produce some different html files.

My first problem is I can't seem to figure out how to get this to
appear at the top of my output file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

The next problem I'm having is how to include an extra file in the
output. I had some very old scripts which could parse html files with
server side includes and produce static html files that didn't need a
server with SSI enabled. I'd been using this mechanism to include a
standard footer and some navigation links on all web pages. Since I'm
looking to migrate towards xml and xslt I'm trying to find a way to
still include the contents of a file in the output.

The .dtd file .xsl file, and input .xml file's I have so far are at:

http://home.comcast.net/~dmcmahill/tmp/gallery.dtd
http://home.comcast.net/~dmcmahill/tmp/gallery.xsl
http://home.comcast.net/~dmcmahill/tmp/drawings1.xml

xsltproc gallery.xsl drawings1.xml drawings1.shtml

seems to give the right thing except for the DOCTYPE bit and I still
need to run my homebrewed SSI processor to convert the .shtml file to
..html.

Any suggestions? Am I going about this completely the wrong way? For
how much programming in all sorts of languages, I'm finding xslt rather
confusing...

-Dan

Dec 31 '06 #1
3 2525
danmc91 wrote:
My first problem is I can't seem to figure out how to get this to
appear at the top of my output file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
Use the xsl:output instruction e.g.
<xsl:output
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"

doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d"/>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 1 '07 #2
danmc91 wrote:
The next problem I'm having is how to include an extra file in the
output. I had some very old scripts which could parse html files with
server side includes and produce static html files that didn't need a
server with SSI enabled. I'd been using this mechanism to include a
standard footer and some navigation links on all web pages.
The XSLT language has an xsl:include instruction to include stylesheet
modules. Then there is the document function to load secondary XML
documents to be processed besides the main XML input.

That means you have two choices, if the footer is a snippet of
well-formed X(HT)ML (e.g.
<div xmlns="http://www.w3.org/1999/xhtml">
<p>....</p>
</div>
) then you can pull it in with the document function and simply copy it
to the result tree e.g.
<xsl:copy-of select="documen t('footer.xml')/*"/>
Note the namespace declaration above in the snippet, if your aim is to
output XHTML then the separate file needs to have the XHTML namespace
declaration present if you simply want to copy the elements.

Alternatively you could write a stylesheet module with a named template
making up the footer e.g.
<xsl:template name="make-footer" xmlns="http://www.w3.org/1999/xhtml">
<div>
<p>...</p>
</div>
</xsl:template>
then include that stylesheet with xsl:include and call e.g.
<xsl:call-template name="make-footer"/>
where you want to include the footer.

These are the tools XSLT 1.0 offers, additionally you might want to look
into XInclude to compose XML from different sources independent of XSLT.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 1 '07 #3
Thanks Martin! Both of your suggestions worked and did exactly what I
was trying to do.

-Dan

Jan 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1482
by: J. Chris Tilton | last post by:
I was given the task of parsing XML docs with SAX. I am trying to use sax implementing filters to do the processing. In some circumstances the XML document will simply be output verbatim (what is read in is simply output with no changes) - including the DOCTYPE from the input XML. I had a problem where namespaces were not being output, but I was able to figure this out. But the DOCTYPE is simply being "eaten" by the parser. Is there a...
3
2834
by: bill turner | last post by:
I've searched the web and news groups. It seems others have had this problem. Unfortunately, the solution seems to be exactly what I've coded. If anybody can point out what is wrong, I'd truly appreciate it. What I am trying to do is to write an xml file to a local disk file. Everything else comes out just fine. However, the DOCTYPE node is not created. I've tried a number of different things, including specifying that I wanted a...
13
3666
by: Tjerk Wolterink | last post by:
Hello i've an xsl stylesheet that must support xhtml entities, my solution: ---- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xsl:stylesheet > <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11
3121
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some useful utils that more pages on that server can use. As an example, I have created a Page Counter class that opens an Access .mdb file, counts the current entries for that page, and adds a new entry with some information regarding the current...
2
1194
by: Ian | last post by:
Hi there, I have been playing around with DIV TAGS in dreamweaver and just created a webpage in VS which I was going to edit later in Dreamweaver.. Once i attached all my divs and css etc, the css positioning wasn't working but I fixed it it was this line ... it needs to be this
2
2330
by: intrepidca | last post by:
When I try to translate an XML file (using org.apache.xalan.xslt.Process) that has a DOCTYPE declaration, I only get the <?xml ...?> processing instruction in the output file. I get no error messages. If I remove the DOCTYPE declaration it works fine. I have checked that the XML file is valid according to the DTD (using xmllint) and that checks out. Here are snippets from the XML and the XSL files and debugging output from xalan: the...
6
7842
by: Rolf Welskes | last post by:
Hello, if I have for example: <table style="width: 100%; height: 100%;" border="1"> <tr> <td style="width: 100px">k </td> <td style="width: 100px">k </td> </tr>
1
6478
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
6
7935
by: WT | last post by:
Hello, I am searching for a way to generate automatically from codebehind the <!Doctype....for asp.net pages using .net 3.5 c# and vs2008. Subidiary question: if I do a server transfert in my codebehind, do I need any Doctype or html tags in the page ? Thanks CS
0
8381
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8797
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8583
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8656
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1786
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.