473,586 Members | 2,702 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 2570
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
2692
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...
2
3169
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...
20
6759
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
1898
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...
13
3656
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
1125
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
1752
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...
21
4595
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...
0
7839
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...
0
8338
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...
1
7954
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...
1
5710
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...
0
5390
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...
0
3836
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...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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
0
1179
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...

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.