473,320 Members | 1,600 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,320 software developers and data experts.

Problem changing attributes into elements

Hi all,
I need to design an XSL to convert this xml:
Expand|Select|Wrap|Line Numbers
  1. <Fields>
  2. <Field Name="DebitCredit" Type="invoicecredit">Debit Factuur</Field>
  3. </Fields>
  4.  
into:
Expand|Select|Wrap|Line Numbers
  1. <Fields>
  2. <DebitCredit>Debit Factuur</DebitCredit>
  3. </Fields>
  4.  
The xsl needs to be imported into an application, which is where my problem starts. I have the following xsl (which works) but for some reason (maybe the XPath being used? could be 1.0, not sure) the application doesn't accept it, so I need something without the variables (I think)
Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="Fields/Field">
  2.   <xsl:variable name="naam" select="(@Name)"></xsl:variable>
  3.   <xsl:element name="{$naam}">
  4.     <xsl:value-of select="."/>  
  5.   </xsl:element>
  6. </xsl:template>
  7.  
Can somebody help me please?
Apr 13 '10 #1
4 2727
jkmyoung
2,057 Expert 2GB
Remove the parentheses from your variable declaration
<xsl:variable name="naam" select="@Name"/>

You could also go:
<xsl:element name="{@Name}">

thus negating the need for a variable.
Apr 13 '10 #2
When I remove the parenthesis, I get a message 'is not a qname'?
Apr 15 '10 #3
Dormilich
8,658 Expert Mod 8TB
there is nothing you can do about that in the XSL, you have to change your XML accordingly (QName)
Apr 15 '10 #4
jkmyoung
2,057 Expert 2GB
? Where are you removing the parentheses from? Post your updated code please.
Apr 15 '10 #5

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

Similar topics

1
by: Chris | last post by:
Hi all, I have recently started working with the new XML functionality in PHP5, but I am running into a few problems. Specifically, I am using an Xpath query to try and pull out the data in...
1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
34
by: The Good Son | last post by:
I'm trying to get my head around a problem that has me baffled. The following element: #wrapper {border:1px solid #000;background:#fff;} Renders as expected when using this DTD: ...
4
by: multimatum2 | last post by:
Hello, I need to enable/disable input text forms... But... I need to have the same style (color...) in both modes.. Could you help me ? Thanx a lot A small sample... ...
6
by: Thomas | last post by:
Hi, I'm having a problem with the dynamically created inputfields in Internet Explorer. The situation is the following: - I have a dynamically created table with a textbox in each Cell. - It...
8
by: horos | last post by:
hey all, Ok, a related question to my previous one on data dumpers for postscript. In the process of putting a form together, I'm using a lot of placeholder variables that I really don't care...
3
by: John R. | last post by:
I have an application written in C# and i am using MS XML DOM! I have a document with the following structure (only the <DicEntry> - Elements are important): <NewDataSet...
2
by: Urs Vogel | last post by:
Hi When using XmlDocument, I can create nodes and attributes as I like. What I didn't achieve is changing the Value of a node (created with createElement), it claims that it's the wrong node...
0
by: Dionysusmtl | last post by:
I'm working on a flash portfolio that loads examples of our work (jpgs) into a movie. For example, it started off using an xml list to display certain images but I found it necessary to draw info...
5
by: vaibhav03 | last post by:
Hello All, I have made an AJAX call and bringing back some data from the server and then That data would be converted to XML through javascript. Now i am creating various elements like TABLE, TR,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.