I have an XML document that I am trying to display in my ASP.NET page.
I am using an XSL Transform to display repeating XML data in a
specific format.
It reads the data, and displays it on my page, but there's a problem.
It runs all the data together on one line.
The XSL file is as follows:
-- begin xml ---
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/guestbook">
<xsl:apply-templates select="guestbook" />
<xsl:value-of select="name" />
<xsl:apply-templates select="guestbook" />
<xsl:value-of select="comment" />
</xsl:template>
</xsl:stylesheet>
-- end xml ---
I've tried putting <BR> in between the name and comment in the XSL
file and ASP.NET strips it out. I view the source in my browser and
for some reason ASP.NET just sends all the XML data as one string on
one line. I can't even figure out how to put spaces between the two
items.
I'd like to see:
Joe Blow
Hello, My Name is Joe.
Instead, what I get is:
Joe BlowHello, My Name is Joe.
Please help!!! 2 2013
The XSL transform document requires exact XML formatting. Your <BR>
will need to change to <BR/>. Other than that, I would think that
would work. As for the space, you need to use the XSL variant of a
space. Somthing like #160; or something like that. (been a while for
xsl for me)
On 7 Apr 2004 19:20:58 -0700, ba******@yahoo.com (Barry Anderberg)
wrote: I have an XML document that I am trying to display in my ASP.NET page.
I am using an XSL Transform to display repeating XML data in a specific format.
It reads the data, and displays it on my page, but there's a problem.
It runs all the data together on one line.
The XSL file is as follows:
-- begin xml ---
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/guestbook"> <xsl:apply-templates select="guestbook" /> <xsl:value-of select="name" /> <xsl:apply-templates select="guestbook" /> <xsl:value-of select="comment" /> </xsl:template> </xsl:stylesheet>
-- end xml ---
I've tried putting <BR> in between the name and comment in the XSL file and ASP.NET strips it out. I view the source in my browser and for some reason ASP.NET just sends all the XML data as one string on one line. I can't even figure out how to put spaces between the two items.
I'd like to see:
Joe Blow
Hello, My Name is Joe. Instead, what I get is:
Joe BlowHello, My Name is Joe. Please help!!!
First of all, that's all your XSLT will ever do irrespective of the XSLT
engine or framework.
You need to either generate HTML (the preferred method of output for XSLT
when trying to present data) or add the newline characters in yourself as
unicode character codes:
eg. newline is 
 [I think]
Try this example to see what should be happening (generates HTML):
XML:
<root>
<guestbook>
<entries>
<entry>
<name>Joe</name>
<comment>Nice place</comment>
</entry>
<entry>
<name>Jan</name>
<comment>Thanks for the lovely food</comment>
</entry>
<entry>
<name>Tim</name>
<comment>Thanks</comment>
</entry>
</entries>
</guestbook>
</root>
XSLT:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml" omit-xml-declaration="yes"/>
<!-- Generate the root html node -->
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<!-- Match for the guestbook element -->
<xsl:template match="guestbook">
<h1>My Guestbook</h1>
<!-- Allow the default templates to process the remainder of the
document -->
<xsl:apply-templates/>
</xsl:template>
<!-- Match for the entry element -->
<xsl:template match="entry">
<h2>
<xsl:value-of select="name" />'s comment was:
</h2>
<p>
<xsl:value-of select="comment" />
</p>
<xsl:if test="not(position()=last())">
<hr/>
</xsl:if>
<!-- No need to apply further templates -->
</xsl:template>
</xsl:stylesheet>
Gives (XHTML):
<html>
<h1>My Guestbook</h1>
<h2>Joe's comment was:
</h2>
<p>Nice place</p>
<hr />
<h2>Jan's comment was:
</h2>
<p>Thanks for the lovely food</p>
<hr />
<h2>Tim's comment was:
</h2>
<p>Thanks</p>
</html>
Hope this helps.
Chris.
"Barry Anderberg" <ba******@yahoo.com> wrote in message
news:9d**************************@posting.google.c om...
I have an XML document that I am trying to display in my ASP.NET page.
I am using an XSL Transform to display repeating XML data in a
specific format.
It reads the data, and displays it on my page, but there's a problem.
It runs all the data together on one line.
The XSL file is as follows:
-- begin xml ---
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/guestbook">
<xsl:apply-templates select="guestbook" />
<xsl:value-of select="name" />
<xsl:apply-templates select="guestbook" />
<xsl:value-of select="comment" />
</xsl:template>
</xsl:stylesheet>
-- end xml ---
I've tried putting <BR> in between the name and comment in the XSL
file and ASP.NET strips it out. I view the source in my browser and
for some reason ASP.NET just sends all the XML data as one string on
one line. I can't even figure out how to put spaces between the two
items.
I'd like to see:
Joe Blow
Hello, My Name is Joe.
Instead, what I get is:
Joe BlowHello, My Name is Joe.
Please help!!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Barry Anderberg |
last post by:
I have an XML document that I am trying to display in my ASP.NET page.
I am using an XSL Transform to display repeating XML data in a
specific format.
It reads the data, and displays it on my...
|
by: Akbar |
last post by:
Hey there,
Big-time curiosity issue here...
Here's the test code (it's not that long)... it's to display a large
number of image links with captions, ideally pulled in from an
external file...
|
by: Wynter |
last post by:
RE: from Displaying a Document using the ASPNET user account to the Client Browser discussion (3/2/2004
Buddy
Thanks for helping me on getting the document to display. But now I am left with a...
|
by: Matt Kruse |
last post by:
http://www.JavascriptToolbox.com/bestpractices/
I started writing this up as a guide for some people who were looking for
general tips on how to do things the 'right way' with Javascript. Their...
|
by: Anthony Harkness-Gripe |
last post by:
This is a very simple XSLT, and I'm doing it ways that I've had work
before, but it's not displaying HTML. Is there a flaw in my logic?
C#:...
| |
by: DazedAndConfused |
last post by:
I have a 8.5 x 11 landscape document with about 1/4 inch of space on the
left and right where there is no print.
The document displays perfect in print preview, but when I print it, about
1/2 inch...
|
by: Lis |
last post by:
Hi,
I have inconsistent behavior of document() function which I hope someone can
explain.
I have Windows Service (runs as LocalSystem) that perform some Xslt
transformation. In the stylesheet...
|
by: Rusty |
last post by:
Hi, our intranet web site needs to add this feature. I've got the
components but just need the last step to get it going.
Here's the setup.
1) a user clicks on a link which calls a web service...
|
by: David W. Fenton |
last post by:
I've been struggling the last two days with something I thought was
very easy, which is to open a web page with a form on it and
populate the form with data passed in a query string (either POST or...
|
by: littlealex |
last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS!
In IE6 the text for the following page doesn't display properly - rather than being...
|
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...
| |
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,...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |
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 ...
| |