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

xslt and xml problem

Hi to all,

I have a xml file with labels and data.

Im trying to mix both files to generate someting like:

Label A : data of node a
Label B : data of node b
Label C : data of node c

My main problem its that the only thing that i know is that the number of
node labels is equal to the nodes of data.

<MYDataSet>
<Table1>
<A>Label A</A>
<B>Label B</B>
<C>Label C</C>
<D>Label D</D>
</Table1>
<Table3>
<A>Data of Node A</A>
<B>Data of node B</B>
<C>data of node c</C>
<D>data of node d</D>
</Table3>
</MYDataSet>

For other hand i have this xslt sheet:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" />
<xsl:template match="/MYDataSet">
<table>
<tr>
<td>
<h2>Detalle de electricidad</h2>
</td>
</tr>
<xsl:apply-templates select="Table1"/>
</table>
</xsl:template>
<xsl:template match="Table1/*">
<tr>
<td><xsl:value-of select="."></xsl:value-of></td>
<td><xsl:value-of
select="../../Table3/ancestor::name/."></xsl:value-of></td>
</tr>
</xsl:template>
</xsl:stylesheet>
Oct 25 '07 #1
3 1156
i don't understand very well what you're trying to accomplish but i
think you should check this out:
http://www.w3schools.com/xsl/xsl_for_each.asp

Oct 25 '07 #2
"Josema" <Jo****@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.com...
Hi to all,

I have a xml file with labels and data.

Im trying to mix both files to generate someting like:

Label A : data of node a
Label B : data of node b
Label C : data of node c

My main problem its that the only thing that i know is that the number of
node labels is equal to the nodes of data.

<MYDataSet>
<Table1>
<A>Label A</A>
<B>Label B</B>
<C>Label C</C>
<D>Label D</D>
</Table1>
<Table3>
<A>Data of Node A</A>
<B>Data of node B</B>
<C>data of node c</C>
<D>data of node d</D>
</Table3>
</MYDataSet>

For other hand i have this xslt sheet:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" />
<xsl:template match="/MYDataSet">
<table>
<tr>
<td>
<h2>Detalle de electricidad</h2>
</td>
</tr>
<xsl:apply-templates select="Table1"/>
</table>
</xsl:template>
<xsl:template match="Table1/*">
<tr>
<td><xsl:value-of select="."></xsl:value-of></td>
<td><xsl:value-of
select="../../Table3/ancestor::name/."></xsl:value-of></td>
</tr>
</xsl:template>
</xsl:stylesheet>
Please don't multipost. The right place for this question is the XSL group
to which you posted 1 minute or less prior to posting this one. C# is
clearly not the place for an XSL question.
--
Anthony Jones - MVP ASP/ASP.NET
Oct 25 '07 #3
While I tried to help, I agree.

Please avoid multi-posting.

"Anthony Jones" <An*@yadayadayada.comwrote in message
news:eH**************@TK2MSFTNGP05.phx.gbl...
"Josema" <Jo****@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.com...
>Hi to all,

I have a xml file with labels and data.

Im trying to mix both files to generate someting like:

Label A : data of node a
Label B : data of node b
Label C : data of node c

My main problem its that the only thing that i know is that the number of
node labels is equal to the nodes of data.

<MYDataSet>
<Table1>
<A>Label A</A>
<B>Label B</B>
<C>Label C</C>
<D>Label D</D>
</Table1>
<Table3>
<A>Data of Node A</A>
<B>Data of node B</B>
<C>data of node c</C>
<D>data of node d</D>
</Table3>
</MYDataSet>

For other hand i have this xslt sheet:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" />
<xsl:template match="/MYDataSet">
<table>
<tr>
<td>
<h2>Detalle de electricidad</h2>
</td>
</tr>
<xsl:apply-templates select="Table1"/>
</table>
</xsl:template>
<xsl:template match="Table1/*">
<tr>
<td><xsl:value-of select="."></xsl:value-of></td>
<td><xsl:value-of
select="../../Table3/ancestor::name/."></xsl:value-of></td>
</tr>
</xsl:template>
</xsl:stylesheet>

Please don't multipost. The right place for this question is the XSL
group
to which you posted 1 minute or less prior to posting this one. C# is
clearly not the place for an XSL question.
--
Anthony Jones - MVP ASP/ASP.NET


Oct 25 '07 #4

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

Similar topics

1
by: Ola Natvig | last post by:
Hi all I'm working with a long running, threaded server which serves HTTP requests with content which are passed through a XSLT processor. The XSLT processor I'm using is the Pyana processor. ...
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...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
0
by: Mike | last post by:
I'm generating an XSLT document programatically in VB.Net. I'm then trying to apply that XSLT against a cXML document to generate my own internally developed XML document. I'm using RichTextBox...
4
by: Moogy | last post by:
I'm pulling my hair out here. First, I'm new to XML, so that doesn't help, but none of this makes any sense to me. All I'm trying to do is take a simple source XML file and translate it with an...
2
by: chris | last post by:
Hi there, I create an XML file from a dataset like this: System.IO.StreamWriter xmlSW = new System.IO.StreamWriter(FILENAME); dsUserData1.WriteXml(xmlSW, XmlWriteMode.WriteSchema);...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
3
by: thomas.porschberg | last post by:
Hi, I want to read records from a database and export it in an arbitrary format. My idea was to feed a class with a String array fetched from the database and let this class fire SAX events as...
3
by: RC | last post by:
Let's say: if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { // Now I got an XML object here var xmlDocument = XMLHttpRequestObject.responseXML; // next I have...
0
by: ManWithNoName | last post by:
The following question is related to this thread: XSLT, document() function, filename, read non-standard/English characters (like µ) I have a XML file with a non-English character in its name...
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
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
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
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...
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.