473,404 Members | 2,187 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,404 software developers and data experts.

Help with transformation

I'll be grateful if anyone would help me with this problem.
I am trying to construct a stylesheet to transform one xml to another. for example how do I transform:

<root>
<m1>sassy</m1>
<m2>spiffy</m2>
<sp1>suddenly</sp1>
</root>

To:

<mls>
<hd>sassy</hd>
<hd2>spiffy</hd2>
</mls>

Thanks!!!
Jul 6 '07 #1
2 1074
Dököll
2,364 Expert 2GB
I'll be grateful if anyone would help me with this problem.
I am trying to construct a stylesheet to transform one xml to another. for example how do I transform:
[HTML]
<root>
<m1>sassy</m1>
<m2>spiffy</m2>
<sp1>suddenly</sp1>
</root>

To:

<mls>
<hd>sassy</hd>
<hd2>spiffy</hd2>
</mls>
[/HTML]
Thanks!!!
Hello, zoom007!

Please take a look here, see if anything springs your memory:

http://www.thescripts.com/forum/sear...searchid=93714

Continue to stay tuned if not helpful, will try to get you caught up...

Good luck and welcome!
Jul 9 '07 #2
jkmyoung
2,057 Expert 2GB
Create templates based on what each element is mapped to, and then use apply-templates for the rest:
Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="root">
  2. <mls><xsl:apply-templates/></mls>
  3. </xsl:template>
  4. <xsl:template match="m1">
  5. <hd><xsl:apply-templates/></hd>
  6. </xsl:template>
  7. <xsl:template match="m2">
  8. <hd2><xsl:apply-templates/></hd2>
  9. </xsl:template>
  10. <xsl:template match="sp1"/><!-- remove element -->
Jul 12 '07 #3

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

Similar topics

0
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron...
6
by: Jack Smith | last post by:
Help needed on this question. Any help is appreciated. Thanks in advance. Given a binary string (i.e. a finite sequence of 0's and 1's) we choose any two digit substring 01 and replace it by a...
2
by: Ryan | last post by:
I get an error every so often with a DTS package on SQL 7. Error as follows. The connection is currently being used by a task. The connection cannot be closed or re-used. This doesn't happen...
6
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a...
5
by: Kasp | last post by:
Hi, I have an XSL here...and though I understand XML, I am having a hard time understanding what this XSL does? Any help will be appreciated. TIA <xsl:stylesheet...
7
by: CK | last post by:
Hello, I have the 60 MB XML string and I am coding a program in Visual Basic to run a XSL transformation on it. Currently, I'm using the Microsoft standard MSXML 2.0 to create a DOM document, load...
4
by: Mike Conmackie | last post by:
Hi Folks, I've probably omitted something very basic but I have no idea what it might be. The results of my transformation _should_ be an xml file but all I get is the xml declaration...
3
by: Keith Chadwick | last post by:
We current have a bunch of web services that make user of the SQLXML object. A template is created in code which calls several stored procedures each of which returns multiple xml recordsets from...
2
by: TomekR | last post by:
Hello ! I was developing xslt sheet lately and - experimenting - I made mistake resulting in that, the effect of the transformation is not well-formed xml document. I made these tests using...
2
by: HendrikLeder | last post by:
Hello everybody :-) Next year I`ll write my diploma in computer science for business (It`s a degree in Germany) and I`ve some questions about the topic. The diploma will handle about refactoring...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.