Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML elements in XML ( <br>, <p>, <b> etc..) 1

Status
Not open for further replies.

nobuns

Programmer
Feb 26, 2001
3
US
I'm performing a transformNode command in my ASP page, applying a style sheet (XSL) to an XML document.

Everything appears to work fine, but any HTML elements in the XML file (like <br/>'s) aren't appearing in the HTML output. I view the source, and it's like they're just not there at all...

What am I missing? Any help would be greatly appreciated..

 
I'm just guessing based on your post that you want to put the HTML elements into your XSL file rather than your XML file.

-pete
 
I do have HTML elements in the XSL file, that works fine.

But I would like to have just some <br/>'s in the XML itself for formatting some of the data within the fields.

For example, one of the nodes is like this:

<activity>I enjoy fishing, skiing, and hiking.<br/>I also enjoy computers, web development, etc..</activity>

It would be nice to have the <br/> in there, otherwise it's difficult to get the info to display exactly how I want it.

I realize that in the event that some other platform would need to access the XML data, having HTML elements would probably not be a good idea...but this is not the case here. It's just for the web.

thanks in advance,

-Bill
 
Bill,

That's fine but the tag is going to be treated as XML not HTML, you can't change that.

I can think of two techniques right off.

1) Modify the XSL to put in an HTML <br> tag for each XML <br/> element. I don't know the syntax for that or I would show the code. Maybe someone else knows?

2) Use a CDATA Section to hold your HTML content. That way the HTML tags will not be interpreted as XML.

Hope this helps
-pete
 
Thanks, I will look into this.

-Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top