473,773 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT and faulty HTML output

Hi, I got
<xsl:output method="html" encoding="iso-8859-1"
doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="
http://www.w3.org/TR/html4/strict.dtd"/>
in my XSLT file. This should remove all XML related code and replace
with HTML valid code, but with my commandline XSLT
transformer(http://xmlsoft.org/XSLT/) it outputs a xmlns on elements
I'v used <xsl:copy-of select="/some/node"> to produce. Is this how it
should work, or is this a bug/bad implention of XSLT.
Thanks in advance
Nikolai Luthman

Jul 20 '05 #1
2 2116
"Taare" <ni************ *@gmail.com> writes:
Hi, I got
<xsl:output method="html" encoding="iso-8859-1"
doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="
http://www.w3.org/TR/html4/strict.dtd"/>
in my XSLT file. This should remove all XML related code and replace
with HTML valid code
That is not what the html output method is defined to do. It makes
no changes to the result tree at all, so if you have element or attribute
or (in this case) namespace nodes that are not valid in HTML then the
resulting file will not be valid HTML.

What the html output does do is output certain elemnts that correspond
to HTML elements using html syntax, so for example an element br in
no-namespace will be serialised as <br> not <br/>. If your elements are
in a namespace then the html output method has no real effect.
but with my commandline XSLT
transformer(http://xmlsoft.org/XSLT/) it outputs a xmlns on elements
I'v used <xsl:copy-of select="/some/node"> to produce.
Copy-of may or may not be the right the right thing to do, depending on
what your source looks like.

Is this how it
should work, or is this a bug/bad implention of XSLT.

How it should work.
Thanks in advance
Nikolai Luthman

Jul 20 '05 #2


Taare wrote:
<xsl:output method="html" encoding="iso-8859-1"
doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="
http://www.w3.org/TR/html4/strict.dtd"/>
in my XSLT file. This should remove all XML related code and replace
with HTML valid code, but with my commandline XSLT
transformer(http://xmlsoft.org/XSLT/) it outputs a xmlns on elements
I'v used <xsl:copy-of select="/some/node"> to produce. Is this how it
should work, or is this a bug/bad implention of XSLT.


<xsl:output method="html" /> is no magic that creates valid HTML 4.01,
you have to make sure you create valid HTML yourself.
"XML related code" is not removed, instead the XSLT 1.0 specification
states about the output method html
<http://www.w3.org/TR/xslt#section-HTML-Output-Method>:

"an element whose expanded-name has a non-null namespace URI should
be output as XML"

thus if you have elements in a namespace and you copy them to the output
they appear in the output and namespace nodes too.

You have to make sure that you do not copy those nodes if you don't want
them in the output.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3

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

Similar topics

6
2747
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a straight XML file http://www.discovertravelandtours.com/test/templates/test.xml?Location=Germany To another XML file http://www.discovertravelandtours.com/test/templates/test2.xml?Location=Germany
1
5581
by: Lisa | last post by:
I need to apply the HTML formatting tags and the French accented characters in a XML document. The XML is generated from a database that has HTML tags and French accented characters in the records. I have specified <xsl:output method="html"/> and encoding="iso-8859-1". When I apply the xsl:value-of and set the disable-output-escaping to "yes", the HTML formatting tags are displayed correctly, but the French accented characters are...
1
1681
by: Harry Zoroc | last post by:
I would like to treat an xsd Schema file as XML file and to display the targetNamespace and all the imports. That's it. But the following does not work. Why? I did not enter the stylesheet in the xsd file directly but tried to compute the output on the command line e.g. with xalan like: java net.sf.saxon.Transform -o myout.html myschema.xsd myxsltfile.xslt Using Saxon yields no better result. The produced myout.html contains all HTML...
1
2361
by: Mark247 | last post by:
Hi, When transforming an XSLT to HTML I get a very annnoying white spac gap of about 2px under each image. This is particularly annoying as am creating a vertical navigation menu made up of images wit rollovers. I know why the space is there, I just dont know how t remedy the problem in my XSLT. The space is caused by the transforme HTML closing </a> being on the next line from the closing </img> ta and the closing </td> on the next line...
8
6021
by: Kathleen Dollard | last post by:
Hi, Oleg's answer about attribute value templates led me to look back at a different problem, and wonder if someone else had solved it. I want to output an ASP.NET page. Thus I need to output ASP.NET tags and HTML tags. <%@ Page Language= etc...
0
2358
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag, such as a div with a runat=server. I can somewhat do this if I create a server control and include the control within the html div tag but this method (borrowed from ASP.NET Website Programming by Wrox press thanks guys) does not give me the full...
3
2464
by: Andy Dingley | last post by:
>From a thread over in c.i.w.a.h "RFC: From XHTML to HTML via XSLT" http://groups.google.co.uk/group/comp.infosystems.www.authoring.html/msg/f112c230061ffe86 As is well-known, the XSLT HTML output method should generate <br> rather than <br /or <br></br> From: <http://www.w3.org/TR/xslt#section-HTML-Output-Method> : The html output method should not output an end-tag for empty
2
22779
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values in the attribute of an element. Instead of using the <xsl:attribute> element, you can simply place the xpath in the attribute itself. The most common usage of this is in creating hyperlinks.
4
11952
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report> </myXml> I there a way that the XSLT transformation can render the content as html rather than text?
0
9621
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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
10106
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...
0
9914
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...
0
8937
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, and deployment—without 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...
0
5355
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...
1
4012
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
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
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.