473,748 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Avoid collapsed tags

I'm using <xsl:copy-of select="content " /on the following XML:

<?xml version="1.0"?>
<content>
<p></p>
<p>This is a paragraph</p>
<p></p>
<p>This is another paragraph</p>
</content>

The empty paragraphs, <p></p>, become <p/when outputted to the browser.

How can I prevent this? I want to add an empty comment (or something else?)
so the paragraph tags aren't collapsed, eg. <p><!-- --></p>
Jul 16 '08 #1
1 1402
Hvid Hat wrote:
I'm using <xsl:copy-of select="content " /on the following XML:

<?xml version="1.0"?>
<content>
<p></p>
<p>This is a paragraph</p>
<p></p>
<p>This is another paragraph</p>
</content>

The empty paragraphs, <p></p>, become <p/when outputted to the browser.

How can I prevent this?
If you want to output HTML then make sure you use
<xsl:output method="html"/>
that should fix that.
I want to add an empty comment (or something else?)
so the paragraph tags aren't collapsed, eg. <p><!-- --></p>
I don't think you need the comment, xsl:output method="html" should suffice.
As for adding a comment you would need
<xsl:template match="p[not(node())]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:comment/>
</xsl:copy>
</xsl:template>
then you need to make sure you don't use xsl:copy-of select="content "
but instead apply-templates.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 16 '08 #2

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

Similar topics

3
1668
by: jbailo | last post by:
Some say that with higher productivity, the American worker has too much time on his hands. True, just witness this innovative 'erotica' site: http://www.snotgirls.com/preview1.html For those not daring enough to click the link, the intro declares,
2
258
by: david | last post by:
When I create a web site, there are some places that allow user to input html code, like in content of a message. But for security purpose, you can not allow user use all html features, like javascript. I found some sites are using UBB code and claim it is safer. I am wonderring if .NET provides some easier way for this? I feel that .NET does have a feature to avoid user type in html code, but is there a feature that allows some safe html...
0
1103
by: Jesse Liberty | last post by:
Is it possible to feed an XML document to an Iframe, but have the contained elements start out collapsed (so that you must click on them to open them) rather than having the entire document open (and you must click on them to close them)? Thanks.
0
1267
by: Hal | last post by:
How do you change the Background Color for a (collapsed) Date Time Picker control from the default white? (I can change every other color setting on this control like its background color when its EXPANDED to a full calendar... but not when it's collapsed.) Thanks.
2
3073
by: Rick | last post by:
Let me start by saying that I know very little about JavaScript. The software that I use to convert my FrameMaker files to HTML uses a JavaScript to hide certain text. The user has to click the paragraph to display that text. Currently, that collapsed text prints only if I go ahead and expand it on my HTML page. I want to be able to have that text automatically print, regardless of whether the user has expanded it on the HTML page.
11
7456
by: Schraalhans Keukenmeester | last post by:
I have tried to collapse a long part of a text on my weblog using the following construct: <style> div.expand { display : none; } div.expand:hover (display : inline; } div.expand em {display : inline; } </style> <p>Blablabla etc lorem ipsum yadayada</p>
3
3526
by: Tor Inge Rislaa | last post by:
I have a MasterPage containing a TreeView menu. When clicking a menu item, a page is loaded into the ContentPlaceHolder. It seems like both the MasterPage and the page in the ContentPlaceHolder is refreshed when clicking the menu item. That might be how it is supposed to be, but the problem is that the menu in the masterpage returns to it's origin state where all the nodes are collapsed. Is there a way to avoid this from happening? ...
0
1477
by: Salim | last post by:
Hi, There is a problem with CollapsiblePanelExtender CollapsiblePanelExtender1.Collapsed property always returns false even when I collapse or expend. Thanks in advance.
2
1304
by: shapper | last post by:
Hello, I have 3 tables: Posts, Tags and PostsTags. PostsTags relates Posts with Tags and has 3 fields: PostID and TagID. I have all the relationships between tables well defined! I have the following query:
0
8996
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
9386
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...
1
9333
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,...
0
8255
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...
1
6799
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
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();...
0
4608
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
3319
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
3
2217
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.