• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple XSLT question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I'm new to XSLT and I need to change this xml  to the version below.
I would appreciate help with a suitable XSLT to do the transformation

<?xml version="1.0" encoding="UTF-8" ?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
  <ERRORCODE>0</ERRORCODE>
  <DATABASE>Group First Hub.fmp12</DATABASE>
  <LAYOUT>newslaccounts</LAYOUT>
  <ROW MODID="0" RECORDID="172877">
     <accountref>53-132</accountref>
     <name>Mr Alexall Vant</name>
  </ROW>
  <ROW MODID="0" RECORDID="172878">
     <accountref>50-187</accountref>
     <name>Mr William Alan Alexander</name>
  </ROW>
  <ROW MODID="0" RECORDID="172879">
     <accountref>53-415</accountref>
     <name>Mr Apoltolos</name>
  </ROW>
</FMPDSORESULT>


I need this....

<?xml version="1.0" encoding="UTF-8" ?>
<root>
   <rows>
      <row>
           <accountref>53-132</accountref>
           <name>Mr Alexall Vant</name>
      </row>
      <row>
          <accountref>50-187</accountref>
          <name>Mr William Alan Alexander</name>
      </row>
      <row>
          <accountref>53-415</accountref>
          <name>Mr Apoltolos</name>
      </row>
 </rows>
</root>

 
Saloon Keeper
Posts: 7601
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

What do you have so far, and where are you stuck making progress? If you haven't started, what ideas have you had?
 
Saloon Keeper
Posts: 27883
197
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Help with" isn't the same thing as "Please provide a completed solution". We're always happy to help with, and welcome to the Ranch! But we don't provide completed solutions. So if you can supply us with some XSLT that you've been working on, we'll be happy to help you make it work right.

Also, while you've managed not to have your XML samples get mangled by our message editing system, a better presentation would be to wrap the XML samples with Code tags (see the "Code" button on the editor). Code tags allow sample Java code, XML, SQL, and other pre-formatted text to display without being damaged by the typesetting algorithms that our main text editor applies.
 
Marshal
Posts: 28263
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Often when you want to transform one XML to another XML with similar structure, it's best to start with the identity transformation and modify it as required.
 
taggart chesh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply.
Although I'm a developer in many programming languages, I have never used XSLT to modify XML and I've always used code in the past.
I wanted to use XSLT as it seems to be designed exactly for that purpose but I didn't know where to start.
I just needed a quick fix as I didn't want to study another language for an issue that rarely occurs.
I really appreciate your feedback and I'm sorry you couldn't help me on this occasion.
If I need help on other matters, I will surely post another question.
In case someone else has a similar issue, I managed to get this solution for my problem from another forum which works like a dream.

 
Tim Moores
Saloon Keeper
Posts: 7601
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

taggart chesh wrote:I really appreciate your feedback and I'm sorry you couldn't help me on this occasion.


We're sorry too, but maybe you misunderstand how these forums work. We don't provide people with ready-made solutions, we try to guide them towards finding a solution themselves. So if you expect other people to do the work for you, then this forum is not for you.

And, incidentally, we also like people to tell us if they post the same questions elsewhere, so we can all avoid duplication of effort: https://coderanch.com/wiki/660346/Forthright-Cross-Posting-Sites
 
reply
    Bookmark Topic Watch Topic
  • New Topic