i have the following rule,
<xsl:template match="br">
<br/>
</xsl:template>
This should convert all <br/> to <br/>
but, my transformer transforms it all to
<br></br>
Ok this does not look like a problem but i use it in a
web application and microsoft interpretes this
as 2 <br/><br/>
How can i force the transformer to not use the
implicit end tag like this <br/> ? 18 2434
Tempore 10:23:19, die Friday 01 July 2005 AD, hinc in foro {comp.text.xml} scripsit Tjerk Wolterink <tj***@wolterin kwebdesign.com> : How can i force the transformer to not use the implicit end tag like this <br/> ?
Set your output method to 'html'.
regards,
--
Joris Gillis ( http://users.telenet.be/root-jg/me.html)
Ceterum censeo XML omnibus esse utendum How can i force the transformer to not use the implicit end tag like this <br/> ?
If you are writing html then you should use the html output method
and this will be output as <br> However if you are writing xml then
within standard xslt there is no way to customise this although your
system may allow you to specify a non standard serialiser.
If you send xml to IE as text/html then it will parse it as html and
not understanding XML syntax for br is only a small part of the
problems.. If you send it with an XML mime type then it will use an xml
parser and parse it correctly, but you then have to supply a stylesheet
in order for it to display as it doesn't have xhtml support built in.
David
Joris Gillis wrote: Tempore 10:23:19, die Friday 01 July 2005 AD, hinc in foro {comp.text.xml} scripsit Tjerk Wolterink <tj***@wolterin kwebdesign.com> :
How can i force the transformer to not use the implicit end tag like this <br/> ?
Set your output method to 'html'.
regards,
it is set to html:
<xsl:output method="html" indent="yes"/>
David Carlisle wrote: How can i force the transformer to not use the implicit end tag like this <br/> ?
If you are writing html then you should use the html output method and this will be output as <br> However if you are writing xml then within standard xslt there is no way to customise this although your system may allow you to specify a non standard serialiser.
ok im outputting to XHTML TRANSITIONAL:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
So it think i should set the output method to xml,
and internet explorer should see <br></br> as a single br.
If you send xml to IE as text/html then it will parse it as html and not understanding XML syntax for br is only a small part of the problems.. If you send it with an XML mime type then it will use an xml parser and parse it correctly, but you then have to supply a stylesheet in order for it to display as it doesn't have xhtml support built in.
David
Ok i will try to set the response mime type to text/xml,
is text/xhtml also possible?
David Carlisle wrote: Ok i will try to set the response mime type to text/xml,
ok (or application/xml is probably better)
is text/xhtml also possible?
no, the declared type for xhtml is text/xhtml+xml but IE doesn't know about that.
You will need to use <?xml-stylesheet to specify a stylesheet (which can simply be <xsl:copy-of select="."/>
But if you need to send to IE, why not send HTML, which it understands, rather than XHTML, which it doesn't?
I'm sending it as html now, with output method set to html,
but then my document is not valid anymore,
elements like <meta and <br are not closed now,
does html transitional force you to close them??
Another strange thing,
I run 2 separate xsl-processors (my hosting provider runs
another version of libxslt)
My processor understands <xsl:output method="html"
and converts <br></br> to <br>
But the processor at the hostingprovider does not understand it.
It makes me crazy
I thought xsl was a standard, but each processor handles that standard
differently I'm sending it as html now, with output method set to html, but then my document is not valid anymore,
XSLT does not ensure its output is valid, it is the responsibility of
the stylesheet author to do that. If the stylesheet generates an
element foobar then xslt will happily write <foobar>..</foobar>
and the resulting html will not validate.
If you were writing valid xhtml and you change the method to html and
change the doctype to specify an html dtd then it is very unlikely that
the result is invalid html. What validation error do you get?
elements like <meta and <br> are not closed now, does html transitional force you to close them??
They are declared EMPTY in the HTML DTD so they are never opened and
don't need (and can't be) closed. HTML is not an XML language and doesn't
use XML syntax. <br> is the correct syntax for the element (or <BR> as
html is not case sensitive) <br></br> is a syntax error, <br/> is
legal syntax but equivalent to <br>> and should (on a conformant system)
typeset a > after the newline. (Most browsers though don't do this, but
then they don't use conformant html parsers, they use purpose built
parsers aimed to do "something sensible" even in the face of incorrect
markup)
But the processor at the hostingprovider does not understand it. It makes me crazy
The XSLt spec specifies that <xsl:output method="html" must be
understood (that is, not generate an xslt error) but any xslt system may
always ignore the xsl:output instruction and use its own system
specific methods to output the file. (For example in cocoon the output
from xslt is always piped to another trandformation process or
serialiser and so not serialised under the control of the stylesheet and
xsl:output is ignored.
I thought xsl was a standard, but each processor handles that standard differently
At places where the standard explictly authorises this difference.
David
David Carlisle wrote: I'm sending it as html now, with output method set to html, but then my document is not valid anymore,
XSLT does not ensure its output is valid, it is the responsibility of the stylesheet author to do that. If the stylesheet generates an element foobar then xslt will happily write <foobar>..</foobar> and the resulting html will not validate.
If you were writing valid xhtml and you change the method to html and change the doctype to specify an html dtd then it is very unlikely that the result is invalid html. What validation error do you get?
Errors like this:
line 11 column 5 - Warning: <meta> element not empty or not closed
line 25 column 5 - Warning: <link> element not empty or not closed
line 2 column 1 - Warning: <html> proprietary attribute "xmlns:menu "
A piece of the generated html page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html xmlns:r="http://www.wolterinkwe bdesign.com/xml/roles"
xmlns:menu="htt p://www.wolterinkwe bdesign.com/xml/menu"
xmlns:page="htt p://www.wolterinkwe bdesign.com/xml/page"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Scharenb org :: Assurantien en hyptheken</title>
<!--
! Wolterink Webdesign
! (C) Tjerk Wolterink
! tj***@wolterink webdesign.com
! 2005
-->
<meta name="keywords" content="Schare nborg Assurantien">
<meta name="descripti on" content="Berend sen Meubelen">
<meta name="author" content="Tjerk Wolterink;tj*** @wolterink.com" >
<meta name="publisher " content="Schare nborg Assurantien">
<meta name="language" content="nl">
<meta name="robots" content="all">
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/standard.js"></script>
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/xmlhttprequest. js"></script>
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/xmlsax.js"></script>
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/xmlw3cdom.js"></script>
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/vcXMLRPC.js"></script>
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/fck_editor/fckeditor.js"></script>
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/xcm.js"></script>
<script type="text/javascript"
src="http://localhost/webapps/scharenborg/js/submenu.js"></script>
<link rel="stylesheet " type="text/css" media="screen"
href="http://localhost/webapps/scharenborg/css/style.css">
elements like <meta and <br> are not closed now, does html transitional force you to close them??
They are declared EMPTY in the HTML DTD so they are never opened and don't need (and can't be) closed.
With closing i also mean: <br/> (properly closed empty tag)
HTML is not an XML language and doesn't use XML syntax. <br> is the correct syntax for the element (or <BR> as html is not case sensitive) <br></br> is a syntax error, <br/> is legal syntax but equivalent to <br>> and should (on a conformant system) typeset a > after the newline. (Most browsers though don't do this, but then they don't use conformant html parsers, they use purpose built parsers aimed to do "something sensible" even in the face of incorrect markup)
Ok i understand, but html transitional and html strict are not xml
languages? Or am i interchanging xhtml and html wrongly? But the processor at the hostingprovider does not understand it. It makes me crazy
The XSLt spec specifies that <xsl:output method="html" must be understood (that is, not generate an xslt error) but any xslt system may always ignore the xsl:output instruction and use its own system specific methods to output the file. (For example in cocoon the output from xslt is always piped to another trandformation process or serialiser and so not serialised under the control of the stylesheet and xsl:output is ignored.
I thought xsl was a standard, but each processor handles that standard differently
At places where the standard explictly authorises this difference.
So the conclusion of this is:
IF your writing an html application that uses xsl transformation
to output the html, then
you have to change the xsl for each xsltransformer-implementation,
and sometimes it just doest work,
for example with those <br><br/> tags,
Is there no possibility to enforce the parser to use <br/> for
empty tags?
Errors like this:
line 11 column 5 - Warning: <meta> element not empty or not closed
Looks like those come from an XMl parser.
Parsing HTML with an XML parser is like parsing FORTRAN with a CParser,
you get errors, but it doesn't mean that there is anything wrong with
the file.
A piece of the generated html page:
That looks Ok except of course all teh xml namespace declarations
xmlns:... are invald html attributes. With closing i also mean: <br/> (properly closed empty tag)
But as I said /> is XML syntax. It is not the syntax for an empty element
in HTML.
Ok i understand, but html transitional and html strict are not xml languages? Or am i interchanging xhtml and html wrongly?
No version of HTML is an XML language. They are all defined via SGML
DTD. The XML versions are all called XHTML.
So the conclusion of this is: IF your writing an html application that uses xsl transformation to output the html, then you have to change the xsl for each xsltransformer-implementation,
No that is not the conclusion at all.
You don't have to change your stylesheet but you may have to specify
that you want html serialisation in other (system specific) places.
The reason why XSLT doesn't mandate that xsl:ouput always has an effect
is that it allowes the result tree to be passed on as an in-memory treee
(or stream of sax events, or any other internal representation) This is
what happens in cocoon or if you run xslt inside of mozilla.
If the result tree is being passed on in such an in-memory format it is
never serialised to a linear document including tags so the hints on
xsl:output as to how to serialse the tree are never used.
Is there no possibility to enforce the parser to use <br/> for empty tags?
You can force xslt to use <br/> syntax by using the xml output method,
but that is not correct html markup for a line break..
You have to decide what you want to do, generate html or generate xhtml,
and in the later case you need to decide if you want to make IE be able
to read the file as it has no built in xhtml support (unlike say mozilla
or opera which can render xhtml files).
The simplest, if you do not need xhtml in the document, is just to
generate html.
David
David Carlisle wrote: Errors like this: line 11 column 5 - Warning: <meta> element not empty or not closed
Looks like those come from an XMl parser. Parsing HTML with an XML parser is like parsing FORTRAN with a CParser, you get errors, but it doesn't mean that there is anything wrong with the file.
A piece of the generated html page:
That looks Ok except of course all teh xml namespace declarations xmlns:... are invald html attributes. With closing i also mean: <br/> (properly closed empty tag)
But as I said /> is XML syntax. It is not the syntax for an empty element in HTML.
Ok i understand, but html transitional and html strict are not xml languages? Or am i interchanging xhtml and html wrongly?
No version of HTML is an XML language. They are all defined via SGML DTD. The XML versions are all called XHTML.
So the conclusion of this is: IF your writing an html application that uses xsl transformation to output the html, then you have to change the xsl for each xsltransformer-implementation,
No that is not the conclusion at all. You don't have to change your stylesheet but you may have to specify that you want html serialisation in other (system specific) places. The reason why XSLT doesn't mandate that xsl:ouput always has an effect is that it allowes the result tree to be passed on as an in-memory treee (or stream of sax events, or any other internal representation) This is what happens in cocoon or if you run xslt inside of mozilla. If the result tree is being passed on in such an in-memory format it is never serialised to a linear document including tags so the hints on xsl:output as to how to serialse the tree are never used. Is there no possibility to enforce the parser to use <br/> for empty tags?
You can force xslt to use <br/> syntax by using the xml output method, but that is not correct html markup for a line break..
You have to decide what you want to do, generate html or generate xhtml, and in the later case you need to decide if you want to make IE be able to read the file as it has no built in xhtml support (unlike say mozilla or opera which can render xhtml files).
The simplest, if you do not need xhtml in the document, is just to generate html.
David
ok i want html,
but why how do i overcome the problem that the parser/transformer
on the hostingprovider does not listen to the xsl:output method attribute?
Now it just renders to the xml output method, and that does not render
well in internet explorer. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mikko Ohtamaa |
last post by:
From XML specification:
The
representation of an empty element is either a start-tag immediately
followed by an end-tag, or an empty-element tag.
(This means that <foo></foo> is equal to <foo/>)
From XHTML specification:
|
by: Victor |
last post by:
While debugging my stylesheet using XMLSpy, I got a really weird result:
<xsl:if test="$match = true()"> matches even if $match is an empty node
fragment. How can this be?
--
Victor
|
by: Tjerk Wolterink |
last post by:
I have an xsl file wich xsl:includes this file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:page="http://www.wolterinkwebdesign.com/xml/page"
xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent">
<xsl:output method="xml" indent="yes"/>
|
by: n_o_s_p_a__m |
last post by:
My xml doc has many <title></title> and <title> in it, meaning the
nodes have no content (although some do). How can I test for this?
I tried title (doesn't work)
I tried //title (doesn't work)
I tried //title (doesn't work)
I tried //title (doesn't work)
Any suggestions welcome.
|
by: Jyrki Keisala |
last post by:
I have an XML file which looks like this:
<command name="Options" phrase="Options">
<key value="z" extended="NONE" qual="L-CTRL" pause="100" repeat="1"
duration="200"/>
</command>
<command name="Command Room" phrase="Command Room">
<key extended="F2" pause="100" repeat="1" duration="200"/>
</command>
| |
by: |
last post by:
Okay, this is probably a really stupid question - but I just can't figure it
out.
I have a large xml document which is being transformed into another using
..net xsl - some elements inside of which do not have any data at some times
but do at others. If they don't have any data, I want to suppress the
generation of the tag completely in the resulting xml.
So for example, if I have a document:
|
by: darrel |
last post by:
I have a when statement:
<xsl:when test="//pageTitle = not(string(.))">
This should find the 'pageTitle' node that has a sibling of 'linkID' that
matches the '$activeLink' parameter and see if it is empty or not.
The above returns FALSE
However, this:
|
by: tschwartz |
last post by:
I'm trying to write a stylesheet which removes nodes which are empty
as a result of other template processing.
For example, given the following xml, I'd like to:
- remove all "b" elements
- remove all "a" elements which, as a result of "b" element
removal, now have no children
so, starting with:
|
by: Valery |
last post by:
In the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<Plcy service="ILiability" boId ="LifePolicy, 1">
<Prem service="IPremium" boId ="RegularPremium, 1"></Prem>
<L1 service="ILifeMain" type = "Life1">
<FirstName>Sheila</FirstName>
<Age>65</Age>
<Relation>spouse</Relation>
</L1>
|
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,...
|
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,...
| |
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |