473,387 Members | 1,374 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,387 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>
</item>


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 3885
Dormilich
8,658 Expert Mod 8TB
try
Expand|Select|Wrap|Line Numbers
  1. // selects all child nodes of <description>
  2. <xsl:copy-of select="description/node()"/>
regards

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
Dormilich
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

1
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>...
2
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...
2
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...
8
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>...
2
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...
3
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...
6
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
1
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...
8
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">
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
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
1
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...
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
Oralloy
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,...
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...

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.