473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.dtd">

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 2516
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.dtd">
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.dtd"/>

--

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="document('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
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...
3
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...
13
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"...
11
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...
2
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...
2
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...
6
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
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"...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.