473,785 Members | 2,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML to XML newbee help

Hi, Me very confused. I have some XML that I want to convert to a more
basic XML. I have put an example of what I have and what I want, I
have used XSL to convert XML to HTML, but never this way.

The <item numberingtext=" 10.01.01 "> I want in the para tag I
think, but if it has to be it own tag, no worrys.

Any help would be fantastic

Example of what I have:
=============== ==========
<?xml version="1.0" encoding="UTF-8" ?>
<document xmlns:xlink="ht tp://www.w3.org/1999/xlink"
xmlns:html="htt p://www.w3.org/HTML/1998/html4" xml:lang="en"
style="widows: 0; orphans: 0; word-break-inside: normal;
\-ilx-endnote-position: sectionbottom; \-ilx-endnote-style-type:
lower-alpha; \-ilx-footnote-position: pagebottom;
\-ilx-footnote-numbering-policy: continuous;
\-ilx-endnote-numbering-policy: continuous; \-ilx-footnote-style-type:
decimal;\-ilx-block-border-mode: merge;">
<part style="page: pageStyle1;">
<par class="Ahead">D uis autem vel eum iriure dolor in hendrerit in
</par>
<par class="Bhead">v ulputate velit esse consequat</par>
<par class="Normal" style="font-size: 12.0pt;"></par>
<list style="margin-left: 18.0mm; list-style-type: decimal;
\-ilx-list-group: 4; \-ilx-marker-align: left; \-ilx-marker-format:
&quot;%0.%1.%0& quot;; \-ilx-marker-offset: -1020tw;
\-ilx-marker-follow: tab;">
<item numberingtext=" 10.01.01 ">
<par class="MainText " style="\-ilx-tab-stops: &quot;left blank
0tw&quot;;">Lor em ipsum dolor sit amet,
<link xlink:type="sim ple" xlink:show="rep lace"
xlink:actuate=" onRequest" xlink:href="htt p://www.apple.com">
<inline class="Hyperlin k">consectetuer </inline>
</link> adipiscing elit, sed diam nonummy nibh euismod
<inline class="referenc e">tincidunt </inline> ut laoreet dolore
magna aliquam erat volutpat Ut wisi eiim ad minim veniam, quis nostrud
exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea
commodo consequat (B-1664-0010). Duis lobortis autem vel eum iriure
dolor in hendrerit in vulputate velit esse
<link xlink:type="sim ple" xlink:show="rep lace"
xlink:actuate=" onRequest" xlink:href="htt p://www.apple.com">
<inline class="Hyperlin k">molestie</inline>
</link> consequat, vel illum dolore eu feugiat nulla facilisis at
vero eros et accumsan et iusto odio dignissim qui blandit praesent
luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
</par>
</item>
</list>
</part>
</document>


=============== ==========
This is what I want:
=============== ==========
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Ahead>Duis autem vel eum iriure dolor in hendrerit in</Ahead>
<Bhead>vulputat e velit esse consequat</Bhead>
<para>10.01.0 1 Lorem ipsum dolor sit amet,
<link href="http://www.apple.com"> consectetuer</link> adipiscing
elit, sed diam nonummy nibh euismod
ut laoreet dolore magna aliquam erat volutpat Ut wisi eiim ad minim
veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl
ut aliquip ex ea commodo consequat (B-1664-0010). Duis lobortis autem
vel eum iriure dolor in hendrerit in vulputate velit esse
<link href="http://www.apple.com"> consectetuer</link> consequat, vel
illum dolore eu feugiat nulla facilisis at vero eros et accumsan et
iusto odio dignissim qui blandit praesent luptatum zzril delenit augue
duis dolore te feugait nulla facilisi.
</para>
</root>
Jul 20 '05 #1
5 1657
Ehy, ma il 1 Jul 2004 02:29:49 -0700 (ad****@btopenw orld.com
(Adam)) ha detto:
Example of what I have:

please simplify your from-XML and to-XML and i'll help u.

--
baldo
Jul 20 '05 #2
Hi,

I want to convert the XML at the top using XSL to cleaner XML, to then
be used in other aplications.

Can this be done?.
Thanks

Baldo <no@no.no> wrote in message news:<v6******* *************** **********@4ax. com>...
Ehy, ma il 1 Jul 2004 02:29:49 -0700 (ad****@btopenw orld.com
(Adam)) ha detto:
Example of what I have:

please simplify your from-XML and to-XML and i'll help u.

Jul 20 '05 #3
ad****@btopenwo rld.com (Adam) wrote in message news:<6e******* *************** ****@posting.go ogle.com>...
Hi, Me very confused. I have some XML that I want to convert to a more
basic XML. I have put an example of what I have and what I want,
Try this:

Notes:
- I'm ingnoring some whitespace issues that are rarely significant.
You'd need to supply a better spec before going there.

- I guess the text of the second link in your example was a typo.

- This is an impossible problem to solve, as a general case from one
example. I can make it work (quite easily) for that one case, but a
couple of examples don't _define_ a mapping (I had to guess at this,
and it's a 50:50 guess between whether to map <item> or <par
class="MainText "> as the output <para>).

As a reductio ad absurdum, I could simply have wrapped your output
example in a <xsl:template > element (literal text and all !) and
called that a valid solution to the stated question. You see the
problem ?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:styleshe et
version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:xlink="ht tp://www.w3.org/1999/xlink"
exclude-result-prefixes="xlink "


<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="link" >
<link href="{@xlink:h ref}" ><xsl:value-of select=".//text()"
/></link>
</xsl:template>

<xsl:template match="par[@class='Normal']" />

<xsl:template
match="par[@class='MainTex t']" >
<para>
<xsl:value-of select="transla te (parent::item/@numberingtext,
' ', ' ')" />
<xsl:apply-templates select="* | text()" />
</para>
</xsl:template>
<xsl:template
match="par[@class and not (@class = 'Normal' or @class =
'MainText')]" >
<xsl:element name="{./@class}" ><xsl:value-of select="text()"
/></xsl:element>
</xsl:template>
<xsl:template match="document/part" >
<root>
<xsl:apply-templates select="*" />
</root>
</xsl:template>

</xsl:stylesheet>
Jul 20 '05 #4
Thank you very much, will give this a go, and let you know how I get on.

Again Thanks
Adam
Jul 20 '05 #5
Hi Andy

Thanks that's fantastic, works just the way I wanted it to do.
Adam
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1929
by: Newbee | last post by:
Hi ! Let's say that this is the folder on the server: /web/firstDir/secondDir/images/image.gif where i have stored my pictures. I have tryed with apsolute and relative paths but i can't display images.... If i right click on the image the whole path is displayed on this way: http://www.test.com/Dir1/Dir2/Dir3/web/firstDir/secondDir/images/image.gif Should i define global variables(?) or how to solve this....
2
1661
by: Newbee Adam | last post by:
some said that .NET app can run on any program where rutime exists. What is "runtime" in this sense? will I have to install runtime or .net framework or .NET support on an xp machine for a .NET app to work? keep in mind I am a newbee :-) !! thanks --
4
1782
by: PerryC | last post by:
All, 1. Do the following codes seem ok? 2. If so, then how do I pull the value of YOE1 and YOE2 into my report? (to do some further calculations) ************************************************* Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer) Dim YOE1 As Double
2
1874
by: Martin Hvidberg | last post by:
Dear list I have found a declaration like this: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <math.h> #include "ectemp.h"
9
341
by: EMW | last post by:
I have created a page in aspx and after a click on a button, a new page should open. How is this possible? I tried it doing it like in vb.NET with opening a new form, but it doesn't work. rg, Eric
1
1009
by: Mike | last post by:
Hello all, I'm new to vb.net and I was hoping to get a little help. I am trying to write an application where you can select individual files from one directory and copy them to a target directory or drive. I was hoping to set up a form where you would get to lists side by side the lists would start with the target drive on the left side and you should be able to drill down to the target directory. On the right would be the source files...
8
1381
by: ikarias | last post by:
Maybe not the right place to aske this, but a newbee (me) needs help. i trying to input a number into a textbox, so i can make a series of calculations. in the old days of basic i just jused nrstring=val(input) , but life isnt as easy anymore. I brewed something together as a test, but it failes on me. Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ...
2
1422
by: Mel | last post by:
I have a selection box with 3 values. what i need is to pass 3 urls to a function that has a switch statement and based on the selection index goes on one of the tree urls. Question is how do i pass these three urls to the function i already have ? The list size may change and does not necessary have to remain as 3 thanks for lifting a newbee to greater heights
0
1310
by: Martin Arvidsson, Visual Systems AB | last post by:
Hi! I have a couple of newbee questions. I have a .aspx page with a couple of TextBoxes and a submit button. Now... When i press the submitbutton i want the data in the TextBoxes to be saved in my Sql Table.
2
1729
by: Rene | last post by:
Hello to all! I am a newbee to C++, I did a beginners' course, and now I am stuck with a strange problem. I have written the function that is pasted downwards. The peculiar thing is that when I sent the function the value "0", the .lst file is created properly (the vector I am using/saving is made up of structs of one AnsiString (using BCB) called "naam" and one int called "nummer", I guess You'll get what they mean in English ;-))....
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.