f



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&#9;"> 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="http://www.w3.org/1999/xlink"
xmlns:html="http://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">Duis autem vel eum iriure dolor in hendrerit in
</par>
		<par class="Bhead">vulputate 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&#9;">
				<par class="MainText" style="\-ilx-tab-stops: &quot;left blank
0tw&quot;;">Lorem ipsum dolor sit amet,
					<link xlink:type="simple" xlink:show="replace"
xlink:actuate="onRequest" xlink:href="http://www.apple.com">
						<inline class="Hyperlink">consectetuer</inline>
					</link> adipiscing elit, sed diam nonummy nibh euismod 
					<inline class="reference">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="simple" xlink:show="replace"
xlink:actuate="onRequest" xlink:href="http://www.apple.com">
						<inline class="Hyperlink">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>vulputate velit esse consequat</Bhead>
	<para>10.01.01 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>
0
adam44 (8)
7/1/2004 9:29:49 AM
comp.text.xml 8781 articles. 0 followers. Post Follow

5 Replies
1053 Views

Similar Articles

[PageSpeed] 30

Ehy, ma il 1 Jul 2004 02:29:49 -0700 (adam44@btopenworld.com
(Adam)) ha detto:

>Example of what I have:


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

--
baldo
0
no69 (380)
7/3/2004 6:55:28 PM
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:<v60ee01ne7ki7sj38n26b2jjgtuptv0bvf@4ax.com>...
> Ehy, ma il 1 Jul 2004 02:29:49 -0700 (adam44@btopenworld.com
> (Adam)) ha detto:
> 
> >Example of what I have:
> 
> 
> please simplify your from-XML and to-XML and i'll help u.
0
adam44 (8)
7/4/2004 4:54:49 PM
adam44@btopenworld.com (Adam) wrote in message news:<6e8eb718.0407010129.534c4a7b@posting.google.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:stylesheet 
    version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xlink="http://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:href}" ><xsl:value-of select=".//text()"
/></link>
</xsl:template>

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

<xsl:template 
  match="par[@class='MainText']" >
  <para>
  <xsl:value-of select="translate (parent::item/@numberingtext,
'&#9;', ' ')" />
  <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>
0
dingbat (860)
7/5/2004 11:31:28 AM
Thank you very much, will give this a go, and let you know how I get on.



Again Thanks


Adam
0
adam44 (8)
7/5/2004 7:55:21 PM
Hi  Andy

Thanks that's fantastic, works just the way I wanted it to do.


Adam
0
adam44 (8)
7/6/2004 8:39:20 AM
Reply:

Similar Artilces:

To XML or not to XML?
Ok, it has been a while since I've needed to make an involved web page. Coming back on the scene now is a bit confusing, what with all the cool stuff to use like XML, PHP, MySQL, etc... So here is my question. I'm in search of a good dynamic way to generate web pages which separates content from presentation. I am seeking to create a web site that, to put it succinctly, has a list of users and sets of information corresponding to each user. I am familiar with how to do this using PHP, MySQL, and regular old HTML. I maintain the user database in MySQL and dynamically present it and th...

XML to XML
I have a gnucash file that I'm trying to transform into an identical XML file without the invoices. I've been at this for a while now. The gnucash file is in XML and the element I'm looking into is: <gnc:transaction> I want to ignore those that contain <slot:key>gncInvoice</slot:key> which is a child of slot which is a child of slots which is a child of transactions. Any help you're willing to provide would be greatly appreciated. Thanks. Classic application for XSLT. Start with the identity transformation, then add a template which matches the ones yo...

XML or not XML?
I am developing a simple MySQL database editor, and am looking into creating an PHP/AJAX app as the GUI. A lot of this in new ground, and much more is dusting off things I haven't used in a while. My question though involves whether or nor to employ XML. I did some XML a few years back, but don't typically bother anymore. As I see it XML is great when I need to have an app with a standard data presentation that other developers can easily interface. I.E. like a bank statement that may feed a variety of applications developed by a variety of clients. However, if I am develo...

embedding xml in xml as non-xml :)
Hi all, I have an application that logs in xml. Assume <xmlLog></xmlLog>. In this element the app logs anything it gets from foreign hosts. Now if the host sends xml data, the structure of the document changes. ie. <xmlLog><somTag></somTag></xmlLog>. This will cause problems with my log reader, because it assumes that <xmlLog/> contains non-xml data. My question is, is there a way to treat the data in the <xmlLog/> element as non xml data. Something I can do that would treat anything this element contains as a literal? Any help or ...

Off Topic - Databindings and XML
Dear Group First of all, my apologies for posting here. I tried the MS groups but they're so useless. As some of you work with ASP.NET and XML I wondered if you have come across this and can give me some advice as this group is the only reliable source for an answer. Again, my apologies for posting it here. I wonder if I do something wrong and whether this is possible at all. Any hint is greatly appreciated. I have a XML file bound to a Treeview. The treenodes Text/Value properties bind and populate fine if I set them to an attribute of the XML tag. What I would like to do however is s...

Help on including one XML document within another XML document using XML Schemas
Hi I would like to specify an XML schema that would allow an XML document to be included within another XML document. The following example schema gives an idea of what we're trying to achieve ServiceResponse.xsd -------------------- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="serviceResponse" type="ServiceResponse"/> <xs:complexType name="ServiceResponse&quo...

Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser)
Hello Usenet. I'm subject to some confusion with XML and UTF8. I'm working with XML-Simple and I try to decode some XML with with german umlauts (ISO-8859-1). The first XML line declared the encoding correct (see code below). But I'm getting different results using XML-Simple with the default XML parser named XML::Sax and a second parser named XML::Parser. The following code tries to decode the mini XML file and prints the UTF8 flags of the resulting strings. Can someone run this code on his machine and post the results? Thanks. The results on my machine are this: ���ä...

[XML] Is there an XML group?
Hi, I've typed an XML source which calls a CSS source, the result should be a page displayed in IE6, instead I see the XML source. That's pretty logical since there a no XHTML tags for IE6 to interpret. I'm looking for a discussion group like'comp.lang.xml' but I can't find one. Please help me. The first task is to see the Blue Jay. universalbitmapper wrote: > I'm looking for a discussion group like'comp.lang.xml' but I can't find > one. There's a comp.text.xml, which might be what you're looking for. Note that I don't read it,...

XML to XML conversion
Hello, I vageuly remember a standard that allowed for an XML document using one tag vocabulary to be translated to a diffirent XML document using a diffirent tag vocabulary using the information provided in a kind of dictionary XML pointed to in an URL present in the original XML file. I am very interested in trying it out for various applications, but I can't find anything on the internet about it, since I don't remember it's name, only the general appearance. Can anyone help me with this? What I remember, approximately: The idea is that you have one XML file, in which th...

xml from 2 xml
Hi to everybody, would I like to create a consequential xml from the elaboration of two files xml using xslt, but is it possible to give in input to a trasform 2 files xml? thanks for the possible answers I have already found from me the answer: the function document('file2.xml') matatu ha scritto: > Hi to everybody, > > would I like to create a consequential xml from the elaboration of two > files xml using xslt, but is it possible to give in input to a trasform > 2 files xml? > > thanks for the possible answers ...

Cocoon XML to XML
Hello. I want t know if it's possible to use cocoon to run xml to xml pipeline without publishing anyelse, just pipeling ? Has somebody tried this ? Thanks ! 8:0) Cram TeXeD -- "La r�alit�, c'est ce qui refuse de dispara�tre quand on a cess� d'y croire." (Philip K.Dick) <http://texed75.free.fr> ...

XML to Canonical XML
I'm trying to find a Ruby package that will convert valid XML into canonical XML. I found the genx4r gem, but that just generates canonical XML. Any pointers appreciated. Gary Wright On Feb 12, 2008 11:47 AM, Gary Wright <gwtmp01@mac.com> wrote: > I'm trying to find a Ruby package that will convert valid XML into > canonical XML. > Define "canonical XML" James [Note: parts of this message were removed to make it a legal post.] http://www.w3.org/TR/xml-c14n On Feb 12, 2008 10:51 AM, James Britt <james.britt@gmail.com> wrote: > On Feb 12, ...

XML to XML Transformation
I was thrust into XML about 2 weeks ago and don't know much yet. From another department in the corp I am receiving an XML file which concatenates nodes all on one line i.e. <car><make>ford</make><color>red</color><year>2001</year></car><car><make><mb> etc. etc. etc. Some lines are over 300 characters long. I need to translate this spagetti XML into something which is humanly readable. I probably need to use XSL however I'm not sure what I need to do. Any help will be much appreciated. "Will" <william...

no tags in my xml-to-xml transformation, help....
my xml-to-xml transformation is outputting an xml header and then just text like this: <?xml version="1.0" encoding="iso-8859-1"?>e19dbb7b-5529-43a0...... I've searched regarding this problem and it seems that if there's no match in your xsl template then by default everything gets spat out. But I've tested this with very definite matches in my template, and still there are no xml tags in the output. Has anyone seen this before? Any help much appreciated.... Yannick yannicklaclau wrote: > my xml-to-xml transformation is outputting an xml heade...

[rfc-dist] RFC 6207 on The Media Types application/mods+xml, application/mads+xml, application/mets+xml, application/marcxml+xml, and application/sru+xml
A new Request for Comments is now available in online RFC libraries. RFC 6207 Title: The Media Types application/mods+xml, application/mads+xml, application/mets+xml, application/marcxml+xml, and application/sru+xml Author: R. Denenberg, Ed. Status: Informational Stream: IETF Date: April 2011 Mailbox: rden@loc.gov Pages: 11 Characters: 18090 Updates/Obsoletes/SeeAlso: None I-D Tag: draft-denenberg-m...

Non-XML tagged value text to XML
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value> <y>ABC</y> <z>&quot;Hello World&quot;</z> Is XSLT up to the task? What would it look like? Most of the XSLT string processing code I've seen looks very verbose - can't be too efficient. mikea_59 wrote: > I would like to use XSLT to translate some tagged value text to XML > elements like this: > > Input Doc: > > <data>...

ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working
Summary: I have XML as string and I want to pull it into ElementTree so that I can play with it but it is not working for me. XML and fromstring when used with a string do not do the same thing as parse does with a file. How do I get this to work? Details: I have a CGI that receives XML via an HTTP POST as a POST variable named 'theXml'. The POST data is a string that the CGI receives, it is not a file on a hard disk. The POSTed string looks like this when viewed in pretty format: <xml> <purchase id="1" lang="en"> <item id="1"...

web.xml / XML schema issue, why do some XML schema attributes disappear
Hi I'm trying to get my j2ee app to run on Jboss (version 3.2.3), but Jboss complains there are some missing attributes in the web-app element. The attributes are present in the XML file, but they seem to be removed by the parser, also when I view the file in a web browser. My XML below (I have cut out a lot of stuff for the purpose of this post) <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app xmlns="...

Installation of: XML-DOM-1.44, XML-Parser-2.36, XML-RSS-1.47, XML-Simple-2.18
- CPAN Forum Q&A, Installation of; -- XML-Writer-0.606 -- XML-DOM-1.44 -- XML-Simple-2.18 -- XML-RSS-1.47 -- XML-Parser-2.36 As concerns the installation of the four items above, these errors are continously flagged as an intervention to the process; XML-Simple-2.18, flagged: ======================== Checking installed modules... could not find ParseDetails.ini in C: \strawberry\perl\vendor\lib\xml\sax XML::Sax is installed, it will be used by the test suite Could not open 'lib/XML/Simple.pm': No such file or directory at C:/ strawberry/perl/lib/ExtUtils/MM_Unix.pm line 2627. --...

XML DOM: XML/XHTML inside a text node
In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '&lt;', '>' becomes '&gt;'). I want to be able to override this behavior cleanly. I know I could pipe the input through a SAX parser and create nodes to insert into the tree, but that seems kind of messy. Is there a better way? Thanks. On Thu, 2 Nov 2005 noahlt@gmail.com wrote: > In my program, I get input from the us...

Help with passing xml tags within an xml file
Let's say I have the following tags in an xml: <World> <Country>Canada</Country> <Hemisphere>North</Hemisphere> <Weather climate="cold" forecast="snow"> <CommandAction>$(HOME)\calculate.py Canada North snow</CommandAction> </Weather> </World> The CommandAction tag will invoke some python script which takes Country Hemisphere and forecast as parameters. Is there a way to generalize the CommandAction tag so that it can look something like the following: <CommandAction>$(HOME)\ca...

XML Newbie Alert! FOR XML EXPLICIT help please
Apologies for the newbie question. I have read and re-read about FOR XML EXPLICIT and now my head hurts! This is an example of the XML I am trying to form from a very simple SQL table: <Record> <RecordHeader> <HeaderData>HeaderStuff</HeaderData> <HeaderData2>HeaderStuff</HeaderData2> </RecordHeader> <RecordBody> <Body Data>BodyStuff</BodyData> <Body Data2>BodyStuff</BodyData2> </RecordBody> </Record> <Record> <RecordHeader> <HeaderData>HeaderStuff</HeaderData> <HeaderData2>He...

xml wrongly views as text extracted from the xml tags
we have a java framework, where we feed a request xml. this request xml is forwarded through the framework, tomcat and axis, for the backend processing, and the processing results are again received by the internet explorer, after they are transformed with an xslt by the framework. now the problem that we are facing is like - the explorer extracts the text inside all xml tags of the response xml and shows it as simple text. but, if you view the source of the 'text', it will show it all as well-formed xml. moreover, if you save the source as an xml file, and again open it through inte...

Generate xml node tree from xmi (xml) help
Hi, I am using argouml ( really neat UML modeling tool) to create a model. I export the model to xmi format ( it's xml). My UML-diagram looks like this: Brand A | -------------------- | | | Brand B Brand C Brand D And Brand B, Brand C and Brand D can also have children and so on ......... I need to generate an xml file that can describe these relationships like: <MyModel> <Brand A> <Brand B> </Brand B> <Brand C> </Brand C> <Brand D> </Brand D> </B...

Web resources about - XML to XML newbee help - comp.text.xml

Newbee Republican Congressman Laughed At By Michigan Constituents
I used to have a friend who sold malpractice insurance to doctors, and she said that as a group, they weren't all that smart. This little town ...

Newbee take back top spot in the Chinese Dota scene
The reigning champions of The International are still just as capable of winning as anyone else.

newbee articles on Engadget
newbee articles, stories, news and information.

Team Newbee Wins The International, Earns $5 Million
The final of the official Dota 2 International world championship took place yesterday, with Chinese team Newbee winning the $5 million prize ...

WPC2014 DOTA2季军赛:NewBee vs Alliance
WPC2014 DOTA2世界电子竞技精英赛半决赛,NewBee vs Alliance比赛视频回顾。

Newbee wins first place, $5 million in Dota 2 International
Newbee takes home more than $5 million in prize money after defeating ViCi Gaming in The International Dota 2 Grand Finals today. This is part ...

TI4小组赛视频回顾:Newbee vs Titan #3
... 星际争霸2 CODOL 斗战神 发号中心 怪物猎人OL 自由足球 炉石传说 FIFA Online 3 天涯明月刀 英雄联盟 疾风之刃 逆战 上古世纪 英雄资料 物品资料 DOTA2首页 > DOTA2视频 > DOTA2赛事视频 > DOTA2TI4 TI4小组赛视频回顾:Newbee ...


DotA 2 - The International 2014 - NewBee vs LGD - GosuGamers
... MATCHES MATCHES RANKINGS RANKINGS VODs VODs FORUMS FORUMS DOTA2 WIKI DOTA2 WIKI The International 2014 /Phase Two / Round Robin /Matches /NewBee ...

'Team Newbee' Takes Home $5M Dota 2 Prize in Biggest Ever E-Sports Tournament
The International 4 saw Dota 2 players from around the globe compete for a $10 million prize fund Team Newbee, as its name suggests, was only ...

Resources last updated: 2/29/2016 1:52:46 PM