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

XML to XML Translation

Hi,

I need to translate an XML document into another XML
document. I would like to avoid using XSL that translates
character by character.

Is there a way to map fields between those 2 documents,
and then translate?

Thanks

John Yung

Nov 11 '05 #1
3 1978
I am not exactly sure what you mean when you say that XSL translates
character by character. Maybe that's the case behind the scenes, but it
should not concern you how it's done. XSLT is THE technology to transform
XML documents from one form into another. In the .NET Framework these
transformations leverage the performance optimized implementations.

The XSLTs themselves are not character driven at all, they describe mappings
on a node basis, where nodes are identified through an XPath expression.

Can you give more information, maybe we can give you better answers.

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"John Yung" <jy***@fahnestock.com> wrote in message
news:82****************************@phx.gbl...
Hi,

I need to translate an XML document into another XML
document. I would like to avoid using XSL that translates
character by character.

Is there a way to map fields between those 2 documents,
and then translate?

Thanks

John Yung

Nov 11 '05 #2
John Yung wrote:
Thanks for your reply, I need to translate a XML file into
another XML file.

Original XML File:
<?xml version="1.0" standalone="yes"?>
<trades>
<trade>
<cusip>123456789</cusip>
<rate>0</rate>
<type>S</type>
<quantity>2</quantity>
</trade>
<trade>
<cusip>987654321</cusip>
<rate>0</rate>
<type>B</type>
<quantity>6</quantity>
</trade>
</trades>

New XML File:
<?xml:stylesheet type ="text/xsl"?>
<orders type="orders" tradedate ="2003-07-24"
brokercode="XX">
<order CUSIP="123456789" holdercode="xx" transtype="S"
shares="2"></order>
<order CUSIP="987654321" holdercode="xx" transtype="B"
shares="6"></order>
</orders>

How should I translate those files? Any sample would be
helpful.


It's not clear where orders attributes and holdercode info come from, but you
can start on this one:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="trades">
<orders type="orders" tradedate="2003-07-24" brokercode="XX">
<xsl:apply-templates select="trade"/>
</orders>
</xsl:template>
<xsl:template match="trade">
<order CUSIP="{cusip}" holdercode="xx" transtype="{type}"
shares="{quantity}"/>
</xsl:template>
</xsl:stylesheet>

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #3
Thanks, that is what I needed

John Yung

-----Original Message-----
John Yung wrote:
Thanks for your reply, I need to translate a XML file into another XML file.

Original XML File:
<?xml version="1.0" standalone="yes"?>
<trades>
<trade>
<cusip>123456789</cusip>
<rate>0</rate>
<type>S</type>
<quantity>2</quantity>
</trade>
<trade>
<cusip>987654321</cusip>
<rate>0</rate>
<type>B</type>
<quantity>6</quantity>
</trade>
</trades>

New XML File:
<?xml:stylesheet type ="text/xsl"?>
<orders type="orders" tradedate ="2003-07-24"
brokercode="XX">
<order CUSIP="123456789" holdercode="xx" transtype="S"
shares="2"></order>
<order CUSIP="987654321" holdercode="xx" transtype="B"
shares="6"></order>
</orders>

How should I translate those files? Any sample would be
helpful.
It's not clear where orders attributes and holdercode

info come from, but youcan start on this one:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="trades">
<orders type="orders" tradedate="2003-07-24" brokercode="XX"> <xsl:apply-templates select="trade"/>
</orders>
</xsl:template>
<xsl:template match="trade">
<order CUSIP="{cusip}" holdercode="xx" transtype="{type}"shares="{quantity}"/>
</xsl:template>
</xsl:stylesheet>

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

.

Nov 11 '05 #4

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

Similar topics

0
by: Matt | last post by:
Short Description: The Translation Hub is not picking up the TNS names file. I'm using Oracle 9ids. It doesn't work for any users and it has never worked since it's been installed. Long...
40
by: Chiwa | last post by:
Hey, Expression: Math.floor(x * 100) / 100 x= 4.1 gives 4.09, why in gods name? While other values for x don't give a problem. Thx in advance
5
by: Haines Brown | last post by:
I suspect this is a FAQ, but as a guide to my further investigation, I wondered what the options are for providing readers of my web pages with the ability to translate the pages into their own...
7
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting...
7
by: Peter Eisentraut | last post by:
Greetings. The official PostgreSQL documentation has been translated to German and has been published as a book by verlag moderne industrie/mitp ("PostgreSQL: Das offizielle Handbuch", ISBN...
4
by: Chris Croughton | last post by:
Does a translation unit have to have at least one externally visible declaration or function definition to be valid? As I read the standard, it doesn't: it must have at least one declaration or...
2
by: James | last post by:
In oracle I can do the following: select CONVERT(COLUMNOFNAMES,'US7ASCII') from mytable -- It will take a name like Albrecht Dürer and change it into Albrecht Durer and is useful in where...
1
by: dilabox | last post by:
Hello, I have overloaded the global new, delete, new and delete operators inside a "static library". The library uses private memory allocation routines that must not be accessible from other...
4
by: Tomás Ó hÉilidhe | last post by:
I have a translation unit which defines a global object: BEGIN "yellow.c" int i = 7; END I want this object to be accessible from other translation units, so I give it external linkage....
0
by: Stef Mientki | last post by:
hello, I've build a translation tool, to translate all strings in a python source file. As a extra gadget I added translation through Babel Fish, using beautifulsoup. Although it works...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.