473,473 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Xml+XSL: Problems with FireFox displaying

I have som XML that link to an XSL-file to enable on-the-fly
HTML-generation by e.g. IE or FireFox. The transformation actually works
like a charm, but I have problems with changing line breaks in the XML to
their html-equivilant <br/>.

I use the XSL:

<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '&#xa;')">
<xsl:value-of select="substring-before($text, '&#xa;')"/>
<br/>
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,'&#xa;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

And I apply it to the specific XML-element with the code

<xsl:call-template name="break">
<xsl:with-param name="text" select="description"/>
</xsl:call-template>

When I display the XML-file in IE, it all looks fine and dandy - but when I
load the page in FireFox (1.0 PR), the linebreaks are not converted to
html-<br>-tags.

What am I doing wrong?

And - are there some programs out there that will allow me to supply a
XML-file and a XSL-stylesheet - and then display the result of the
XSL(T)-transaformation?

--
Jesper Stocholm
http://stocholm.dk

"Man knepper ikke en anden ridders mø"
Jul 20 '05 #1
7 6223


Jesper Stocholm wrote:
I have som XML that link to an XSL-file to enable on-the-fly
HTML-generation by e.g. IE or FireFox. The transformation actually works
like a charm, but I have problems with changing line breaks in the XML to
their html-equivilant <br/>.

I use the XSL:

<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '&#xa;')">
<xsl:value-of select="substring-before($text, '&#xa;')"/>
<br/>
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,'&#xa;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

And I apply it to the specific XML-element with the code

<xsl:call-template name="break">
<xsl:with-param name="text" select="description"/>
</xsl:call-template>

When I display the XML-file in IE, it all looks fine and dandy - but when I
load the page in FireFox (1.0 PR), the linebreaks are not converted to
html-<br>-tags.

What am I doing wrong?


Hard to tell, maybe you can post the URLs of a short XML sample and XSLT
demonstrating the problem. I see nothing wrong in that XSLT snippet you
have above but the problem could be with your XML input.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
On Fri, 05 Nov 2004 14:43:52 +0100, Martin Honnen wrote:
Jesper Stocholm wrote:

What am I doing wrong?


Hard to tell, maybe you can post the URLs of a short XML sample and XSLT
demonstrating the problem. I see nothing wrong in that XSLT snippet you
have above but the problem could be with your XML input.


the content is located at http://blog.stocholm.dk

When displayed in IE the result is as expected - but not in FireFox

:-)

--
Jesper Stocholm
http://stocholm.dk

"Man knepper ikke en anden ridders mø"
Jul 20 '05 #3


Jesper Stocholm wrote:
On Fri, 05 Nov 2004 14:43:52 +0100, Martin Honnen wrote:

Jesper Stocholm wrote:


What am I doing wrong?


Hard to tell, maybe you can post the URLs of a short XML sample and XSLT
demonstrating the problem. I see nothing wrong in that XSLT snippet you
have above but the problem could be with your XML input.

the content is located at http://blog.stocholm.dk

When displayed in IE the result is as expected - but not in FireFox


You are transforming to XHTML but inside that template you call the
<br/> elements are in the null namespace so make that

<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '&#xa;')">

<xsl:value-of select="substring-before($text, '&#xa;')"/>
<br xmlns="http://www.w3.org/1999/xhtml" />
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,'&#xa;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>

</xsl:choose>
</xsl:template>

and it should work.

By the way, to output a DOCTYPE node you shouldn't use disable output
escaping but rather the <xsl:output> element.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4
On Fri, 05 Nov 2004 15:03:02 +0100, Martin Honnen wrote:
Jesper Stocholm wrote:
On Fri, 05 Nov 2004 14:43:52 +0100, Martin Honnen wrote:

Jesper Stocholm wrote:
What am I doing wrong?

Hard to tell, maybe you can post the URLs of a short XML sample and XSLT
demonstrating the problem. I see nothing wrong in that XSLT snippet you
have above but the problem could be with your XML input.

the content is located at http://blog.stocholm.dk

When displayed in IE the result is as expected - but not in FireFox


You are transforming to XHTML but inside that template you call the
<br/> elements are in the null namespace so make that


aah ... :o)

<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '&#xa;')">

<xsl:value-of select="substring-before($text, '&#xa;')"/>
<br xmlns="http://www.w3.org/1999/xhtml" />
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,'&#xa;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>

</xsl:choose>
</xsl:template>

and it should work.
It did, thanks.

By the way, to output a DOCTYPE node you shouldn't use disable output
escaping but rather the <xsl:output> element.


Ok - I see your point. I changed it to

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output
doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
encoding="ISO-8859-1"
method="html"
/>

And the above now also looks as intended in FireFox.

Thanks for your help and have a nice weekend,

:o)

--
Jesper Stocholm
http://stocholm.dk

"Man knepper ikke en anden ridders mø"
Jul 20 '05 #5
On Fri, 5 Nov 2004 14:03:01 +0100, Jesper Stocholm <j@stocholm.invalid>
wrote:
And - are there some programs out there that will allow me to supply a
XML-file and a XSL-stylesheet - and then display the result of the
XSL(T)-transaformation?


If you have a recent version of IE, you probably have MSXML somewhere on
your system, if you can figure out how to use it.

Or you can use either of these two open-source XSLT processors

Saxon: http://saxon.sourceforge.net/ (Java based)
Xalan: http://xml.apache.org/xalan-j/ (Java version)
or http://xml.apache.org/xalan-c/ (C++ version)

--
Morris M. Keesan -- ke****@alum.bu.edu

Jul 20 '05 #6
Jesper Stocholm <j@stocholm.invalid> wrote in
news:cb*****************************@40tude.net:

And - are there some programs out there that will allow me to supply a
XML-file and a XSL-stylesheet - and then display the result of the
XSL(T)-transaformation?


If you're looking for something that is free. Try jEdit. I know several
people that like Eclipse and XMLBuddy as well. XMLSpy and StyleStudio are
both good commercial products that will perform XML/XSLT transformation.
The Xalan package has a simple XSTL transformation example that works fine
from a command line.
Jul 20 '05 #7
On Fri, 05 Nov 2004 23:15:41 GMT, Morris M. Keesan wrote:
On Fri, 5 Nov 2004 14:03:01 +0100, Jesper Stocholm <j@stocholm.invalid>
wrote:
And - are there some programs out there that will allow me to supply a
XML-file and a XSL-stylesheet - and then display the result of the
XSL(T)-transaformation?
If you have a recent version of IE, you probably have MSXML somewhere on
your system, if you can figure out how to use it.


I bet I can - I have used it before, I just seem to remember a command-line
tool I once used to test xslt-transformation.
Or you can use either of these two open-source XSLT processors

Saxon: http://saxon.sourceforge.net/ (Java based)
Xalan: http://xml.apache.org/xalan-j/ (Java version)


I will look at the above - or write a small test-harness in C#.

Thanks,

:o)

--
Jesper Stocholm
http://stocholm.dk

"Man knepper ikke en anden ridders mø"
Jul 20 '05 #8

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

Similar topics

5
by: Marcel | last post by:
Hello all, I am working on a generic (php) script to produce (X)HTML Forms through XML and XSL based on field-definitions stored in a database. The basic way i did HTML-forms in PHP was like...
9
by: Tom | last post by:
Hey all, I've been planning to get myself started with DocBook for quite some time now, so when I unexpectedly encountered a task for which DocBook might actually be very useful, I thought I'd...
2
by: kmunderwood | last post by:
I am having trouble changing the font size when extracting xml into an html web page. I think it can be done so many ways, that my searches bring up examples that I am not familiar with. I am a...
2
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
3
by: Steve | last post by:
Is there any way of specifying the startMode when using the xslTransform class? We are updating code which used msxml to the system.xml classes but can find no way to specify the startMode. We...
2
by: KJS | last post by:
Hello, I'm receiving: 'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version' After I try and run my transformation. I spent a good few days coming up with the appropriate (I think)...
2
by: Joe Kraft | last post by:
We just turned on a new website that runs on an XML/XSL templates that get transformed using various .Net objects. The final call is to the MSXML3 TransformNode function. Though the page loads as...
1
by: danc888 | last post by:
I am attempting to write an XSL file to transform the orignal XML document to only show the elements I need. I have a problem though, the XML document contains an xmlns "urn" which when present...
5
by: Kniffel | last post by:
Hi everyone I do a xsl-transformation. And I try to get a Attribute, but I cannot get it. My XML/XSL experience is not very good at the moment. I have something like this: TEST.xml...
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
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
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.