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

2 source documents possible for XSL transformations?

Hello,

I am transforming a document A to target document B.

My Question:
Is it possible to engage a second source document C to the
transformation, thus information from doc A und doc C is being
transformed to document B?

Imagine having a country code like

<customer>
<name>Michelin</name>
<country>FR</country>
</customer>

in document A.

In the second source document C there would be the assignment of the
country codes like:

<country>
<shortkey>FR</shortkey>
<name>France</name>
<president>Chirac</president>
</country>

So document C acts like a "key-value"-file.

In the target document C I want to get this result:
<html>
Michelin - France
</html>

Thanks a lot!

Bernd

Apr 1 '06 #1
3 1247
bl*******@gmx.net wrote:
Hello,

I am transforming a document A to target document B.

My Question:
Is it possible to engage a second source document C to the
transformation, thus information from doc A und doc C is being
transformed to document B?

Imagine having a country code like

<customer>
<name>Michelin</name>
<country>FR</country>
</customer>

in document A.

In the second source document C there would be the assignment of the
country codes like:

<country>
<shortkey>FR</shortkey>
<name>France</name>
<president>Chirac</president>
</country>

So document C acts like a "key-value"-file.

In the target document C I want to get this result:
<html>
Michelin - France
</html>


If the data volumes are small,

<xsl:template match="customer">
<xsl:value-of select="name"/>
<xsl:text> - </xsl:text>
<xsl:value-of select="document('C.xml')
//country[shortkey=current()/country]/name"/>
</xsl:template>

If the data volumes are larger, use <xsl:key> and key()

///Peter
--
XML FAQ: http://xml.silmaril.ie/

Apr 1 '06 #2
Hi Peter,

thanks for your awnser.

I want to try to use the <xsl:key> mechanism.

I wonder now how to include a separate document 'C' with the key
values. Do I include it into the XSL-File? Or into the source file 'A'?
Which syntax do I use? I found something like <include> or <import>,
but I couldn' t find out how to use it.

Thanks for any hints.
Bernd

Apr 12 '06 #3
bl*******@gmx.net wrote:
Hi Peter,

thanks for your awnser.

I want to try to use the <xsl:key> mechanism.

I wonder now how to include a separate document 'C' with the key
values.
If you use keys then you don't include the file at all.
The keys just reference it.
Do I include it into the XSL-File? Or into the source file 'A'?
Neither nor.
Which syntax do I use? I found something like <include> or <import>,
but I couldn' t find out how to use it.


Those are for including and importing files of XSL code, not your
XML documents to process.

Read up on xsl:key and the key() function.

///Peter
Apr 12 '06 #4

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

Similar topics

5
by: Gene Ellis | last post by:
Our sys op won't/can't install the server side XSLT libraries, to allow us perform server-side translations on our webserver It is a Linux machine. Is it possible to put the XML and XSL files on a...
5
by: Nora | last post by:
Hi, I have about 200 xml files which contain one line, that I want to delete. This line is always the last line of the file and it always begins with "<?Pub" Transformations don't work as due...
8
by: Gabriel Genellina | last post by:
Hello I want to convert from pickle format to python source code. That is, given an existing pickle, I want to produce a textual representation which, when evaluated, yields the original object...
115
by: TheAd | last post by:
At this moment I use MsAccess and i can build about every databound application i want. Who knows about a serious open source alternative? Because Windows will be a client platform for some time, i...
115
by: junky_fellow | last post by:
What is a C object ? If i have some function "func()" in my C program, then can i say that "func()" is a C object ? or if i have some function pointer (ptr) which contains the address of...
6
by: Christopher | last post by:
I am currently in the process of evaluating the performance hits of moving to the .NET platform for our application. I created a sample project that loads the transforms the same XML and XSLT in...
0
by: publicityfoss | last post by:
Apologizes for multiple copies eventually received Documents on Migrations to Open Source available by the COSPA Consortium The COSPA consortium (Consortium for studying, evaluating, and...
2
by: bradphelan | last post by:
Hi all, Does anybody know of open source reverse engineering tools that can flowchart C/C++ code? I've checked Red Hat source-navigator but the resolution is only at the call tree level and I am...
6
by: John Larson | last post by:
Hi All, I am some information from INSPEC database records in XML to build a relational database of my own. I am currently trying to extract information by doing an XSLT transform of the XML...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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
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
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
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
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...

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.