Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2008, 04:11 AM
Authorized User
 
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Duplicate Attribute Name

Hello friends,

In My XSLT file i have to use Idnumber twice as it comes 2 times.
Like
<FileHeader idnumber='{id/@Number1}' idnumber='{id/@number2}'

So wat can I do as i want both numbers with same name?


thanks in advance.

 
Old July 24th, 2008, 04:26 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

That would not generate valid XML and is therefore not allowed. You cannot have two attributes with the same name (and namespace).

/- Sam Judson : Wrox Technical Editor -/
 
Old July 24th, 2008, 09:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can't have multiple attributes with the same name, that's a basic XML rule. Use child elements instead:

<FileHeader>
  <idnumber>001</idnumber>
  <idnumber>002</idnumber>
</FileHeader>

Alternatively it's sometimes appropriate to use a space-separated list of values

<FileHeader idnumber="001 002"/>



Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old July 25th, 2008, 01:25 AM
Authorized User
 
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK .thanks.
Quote:
quote:Originally posted by mhkay
 You can't have multiple attributes with the same name, that's a basic XML rule. Use child elements instead:

<FileHeader>
<idnumber>001</idnumber>
<idnumber>002</idnumber>
</FileHeader>

Alternatively it's sometimes appropriate to use a space-separated list of values

<FileHeader idnumber="001 002"/>



Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old July 25th, 2008, 01:26 AM
Authorized User
 
Join Date: Jul 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK.Thanks for your reply.
Quote:
quote:Originally posted by samjudson
 That would not generate valid XML and is therefore not allowed. You cannot have two attributes with the same name (and namespace).

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace an attribute with another attribute georgemeng XSLT 8 June 10th, 2008 11:04 AM
Duplicate forms haipjk Pro VB 6 1 July 27th, 2006 06:21 AM
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
'Duplicate 'AssemblyTitle' attribute' errors hasanali00 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 16th, 2005 09:47 AM
Supressing duplicate p_gauri7 Crystal Reports 2 December 16th, 2004 04:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.