473,804 Members | 3,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT outputting XHTML 4.01 Strict from XHTML 1.0 Strict source

I'm looking for an XSLT that I can use to transform XHTML 1.0 Strict into
HTML 4.01.

Does anyone know of a nice prewritten one?

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #1
8 2577
In article <bv************ *******@news.de mon.co.uk>,
David Dorward <do*****@yahoo. com> writes:
I'm looking for an XSLT that I can use to transform XHTML 1.0 Strict into
HTML 4.01.


The identity XSLT with output method HTML will do exactly that.

The reverse also works if you use an HTML-capable parser.

--
Nick Kew
Jul 20 '05 #2


Nick Kew wrote:
I'm looking for an XSLT that I can use to transform XHTML 1.0 Strict into
HTML 4.01.

The identity XSLT with output method HTML will do exactly that.


Does that really suffice to use an identity transformation with output
method html? I don't think so, if you use the identity transformation
the result elements will be in the XHTML namespace and that means even
with output method html the elements will be serialized according to XML
rules and not HTML rules as the XSLT 1.0 specification states:
an element whose expanded-name has a non-null namespace URI should be
output as XML
Output method html would also not help to get rid of attributes like
xml:lang.
Thus I think instead of simply copying nodes with the identity
transformation you will have to write a stylesheet that throws out the
namespaces, a template for element nodes could look as follows:

<xsl:template match="*[namespace-uri() = 'http://www.w3.org/1999/xhtml']">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*" />
<xsl:apply-templates select="node()" />
</xsl:element>
</xsl:template>
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
Martin Honnen <ma*******@yaho o.de> writes:
Output method html would also not help to get rid of attributes like
xml:lang.


I think the "xml:lang" attribute is the only one in XHTML 1.0 that
causes complications. (In XHTML 1.1, there is also the "version"
attribute of the "html" element.) If the XHTML uses "xml:lang"
attributes, a template is needed to transform these to "lang".

<!-- XHMTL xml:lang attribute -->
<xsl:template match="@xml:lan g">
<xsl:attribut e name="lang">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>

If the XHTML uses both "xml:lang" and "lang" in parallel, a template
is needed to suppress "xml:lang":

<!-- XHMTL xml:lang attribute -->
<xsl:template match="@xml:lan g"/>

--
Dean Tiegs, NE¼-20-52-25-W4
“Confortare et esto robustus”
http://telusplanet.net/public/dctiegs/
Jul 20 '05 #4
Dean Tiegs:
(In XHTML 1.1, there is also the "version" attribute of the "html" element.)


Sorry? Never heard of that one.

--
Bertilo Wennergren <be******@gmx.n et> <http://www.bertilow.co m>
Jul 20 '05 #5
In article <bv************ *******@news.de mon.co.uk>,
David Dorward <do*****@yahoo. com> wrote:
I'm looking for an XSLT that I can use to transform XHTML 1.0 Strict into
HTML 4.01.


Are you looking for an XSLT solution specifically or just a method for
converting XHTML 1.0 Strict to HTML 4.01 Strict? If the latter, you
could just use an HTML serializer as the ContentHandler of a SAX parser.

--
Henri Sivonen
hs******@iki.fi
http://iki.fi/hsivonen/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 20 '05 #6
Bertilo Wennergren <be******@gmx.n et> writes:
Dean Tiegs:
(In XHTML 1.1, there is also the "version" attribute of the "html"
element.)
Sorry? Never heard of that one.


It's complete undocumented (as far as I know), but it's there. The
DTD sets the version attribute of the html element to
"-//W3C//DTD XHTML 1.1//EN" through the use of a #FIXED attribute
declaration.

In xhtml11-flat.dtd, the following lines are involved:

Line 34: <!ENTITY % XHTML.version "-//W3C//DTD XHTML 1.1//EN" >

Lines 4495 to 4506:

<!ENTITY % XHTML.version.a ttrib
"version %FPI.datatype; #FIXED '%XHTML.version ;'"
<!-- see the Qualified Names module for information
on how to extend XHTML using XML namespaces
-->
<!ATTLIST %html.qname;
%XHTML.xmlns.at trib;
%XHTML.version. attrib;
%I18n.attrib;


--
Dean Tiegs, NE¼-20-52-25-W4
“Confortare et esto robustus”
http://telusplanet.net/public/dctiegs/
Jul 20 '05 #7
Nick Kew wrote:
In article <bv************ *******@news.de mon.co.uk>,
David Dorward <do*****@yahoo. com> writes:
I'm looking for an XSLT that I can use to transform XHTML 1.0 Strict into
HTML 4.01.


The identity XSLT with output method HTML will do exactly that.


Oh drat, its got that in it already.

Must be a limitation of the parser (PHP's XMLDOM)

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #8
In article <bv************ *******@news.de mon.co.uk>,
David Dorward <do*****@yahoo. com> writes:
I'm looking for an XSLT that I can use to transform XHTML 1.0 Strict into
HTML 4.01.


The identity XSLT with output method HTML will do exactly that.


Oh drat, its got that in it already.

Must be a limitation of the parser (PHP's XMLDOM)


If the context is PHP, then presumably the context is also Apache?
You could transform to HTML4 in an output filter, using SAX for a tiny
fraction of the overhead of XSLT.

Take your pick of my relevant modules (at http://apache.webthing.com/ )
Any of mod_proxy_html, mod_accessibili ty, mod_xml, or mod_xmlns could
do it as a side-effect of their main purpose!

--
Nick Kew
Jul 20 '05 #9

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

Similar topics

0
2713
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the same XML file with XSL file with a program called XMLspy and i obtained the desire and waited...
2
3177
by: Jesper Moth | last post by:
The MSXML4 xslt-parser would output any source <div/> like this: <div></div> I never figured out how to disable this behaviour. But since it makes the source document look cleaner, and since most browsers require empty divs to be markup up this way, I didn't really give it an extra thought untill I moved to the Tomcat 4.1 where the *reverse* situation applies. The native xslt-parser outputs any <div></div> like this:
20
6802
by: Bernd Fuhrmann | last post by:
Hi! I have some trouble with some simple stupid XSLT-stuff. My stylesheet: ------------- <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
1910
by: Francis Hwang | last post by:
Hi, Maybe this is a newbie question, but: Is there a way to output an element's contents -- including contained nodes and free-form text -- without the containing tags? I can imagine that this request might be against the spirit of XML in general, but the reason I'm trying to do this is that I want to use XSLT for simple generation of XHTML. Basically I want the page's contents in external files, then I want to include them into a...
13
3683
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"
2
1146
by: jopaki | last post by:
Hello all, I am relatively new to XSLT. I am attempting to transform XML and everyting is cool until I introduce these top lines in the source XML (really XHTML): --------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html
3
1762
by: Andrew Jocelyn | last post by:
Hi Is there a way of outputting some xml tags during an XSLT transform? For example when I use the 'xsl:value-of select="xhtml"' statement I'd like to output the children of 'xhtml' after the transform. At the moment the tags are being ignored. I don't want to put the contents inside CDATA because I want to be able to parse the xml file as proper xml elsewhere in the application. <contentItem>
21
4612
by: =?iso-8859-2?Q?K=F8i=B9tof_=AEelechovski?= | last post by:
It is common knowledge that XHTML is better HTML and you can serve XHTML content as HTML. However, the second statement is incorrect, for various reasons; it is enough to say that the HTML validator does not tolerate XML-style empty tags. It seems serving XHTML to the browser is of no advantage and can cause serious problems if the browser does not understand the difference. This raises the question of downgrading XHTML to HTML. I could...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10580
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...
1
10323
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
9157
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7621
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...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
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.