473,372 Members | 931 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

xsl:copy-of not copy element name?

I'm using xsl:copy-of because I need to preserve a break tag in my 'description' element (see below). While it does work, it also copies over the <description> tags and puts them in my HTML, which obviously cannot pass W3C validation. Is there any way to copy everything, except for the <description> tags. Or is there a better way? I'm new at this. Thanks...

Sample from .xml file

<item id="MGEBSK">
<title>A Product Title</title>
<description>A Description that is <br/> really important.</description>

Sample from .xsl transformation file

<xsl:copy-of select="description"/>

HTML output (will not validate):

<description>A Description that is <br/> really important.</description>

Desired HTML output:

A Description that is <br/> really important.
Dec 27 '08 #1
4 3882
8,658 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. // selects all child nodes of <description>
  2. <xsl:copy-of select="description/node()"/>

PS please use [code] tags when posting code, it's much better readable this way
Dec 27 '08 #2
Thanks, that worked great!

Any idea why it changed my break tag from <br/> to <br>? Can that be prevented?

Sorry about the [code] tags... I'll make a note of that.
Dec 27 '08 #3
8,658 Expert Mod 8TB
you're probably using html output method.

yes, use xml output method.
Dec 27 '08 #4
Great! Thanks for your help!
Dec 28 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Alex Sab | last post by:
Hi, I have a XML structure where the element name can be chosen freely but the element attributes must be all of the same names. <Node> <AnyName1 Type="Single" Unit="" Comment="">0</AnyName1>...
by: Fezboy | last post by:
Greetings! I'm trying to import elements declared in the METS and MODS XML Schema into my own. I've gotten to the point where the xsd validates, but when I try to validate a document against...
by: Moonbeam66 | last post by:
I'm looking to convert an element name to an attribute name, where the element name is user-defined. For example <accountNumber>12345678</accountNumber>. I want to convert this to <userTag...
by: Knighterrant | last post by:
I want to copy elements from one namespace to anothor, how to create the xslt? for example, the source data is: <s:mail xmlns:s="urn:source-namespace"> <s:subject>xxxx</s:subject>...
by: Json | last post by:
Ok, brand new to SQLXML 3.0 and its various issues. Heres what I'm trying to do: 1. I am trying to load xml data into an empty SQL table from my .NET console application. 2. This isn't a huge...
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works...
by: adurth | last post by:
Hi! Is there any function that converts a string containing characters that are invalid for use in an element name to a valid one? Thanks, Andreas
by: mato81 | last post by:
Hi all! I am a newbie to WSDL. I have a questions which has been driving me crazy... If I would have a WSDL with a types element somewhat like below, what is the point of the third last row...
by: arunmt07 | last post by:
Hi ALL, Can anyone suggest me how I can get the element name by knowing its attribute value. For eg: <Channel> <US> <C100345> <Article id="345">
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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 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.