473,840 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need XLST for this XML

Very new to XML style sheets and need some help getting this XML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CDSLogger SYSTEM "CDSLogger.dtd" >
<CDSLogger>
<ErrorObject>
<BatchName>Th is is the first batch</BatchName>
<ErrorCode>1290 4</ErrorCode>
<Success>True </Success>
</ErrorObject>
<ErrorObject>
<BatchName>Th is is the second batch</BatchName>
<ErrorCode>1681 8</ErrorCode>
<Success>True </Success>
</ErrorObject>
<ErrorObject>
<BatchName>Th is is the third batch</BatchName>
<ErrorCode>1410 5</ErrorCode>
<Success>Fals e</Success>
</ErrorObject>
<ErrorObject>
<BatchName>Th is is the fourth batch</BatchName>
<ErrorCode>1901 7</ErrorCode>
<Success>True </Success>
</ErrorObject>
<ErrorObject>
<BatchName>Th is is the fifth batch</BatchName>
<ErrorCode>1256 6</ErrorCode>
<Success>Fals e</Success>
</ErrorObject>
</CDSLogger>

to look like this HTML:

<table cellspacing="0" cellpadding="0" height="100%">
<colgroup>
<colgroup span=3>
<thead>
<tr>
<th scope=colgroup colspan=3>CDS Logger Error Messeges</th>
</tr>
<tr>
<th scope=col>Batch Name</th>
<th scope=col>Error Code</th>
<th scope=col>Succe ss</th>
</tr>
</thead>
<tbody>
<tr>
<td>This is the first batch</td>
<td>12904</td>
<td>True</td>
</tr>
<tr>
<td>This is the second batch</td>
<td>16818</td>
<td>True</td>
</tr>
<tr>
<td>This is the third batch</td>
<td>14105</td>
<td>False</td>
</tr>
<tr>
<td>This is the fourth batch</td>
<td>19017</td>
<td>True</td>
</tr>
<tr>
<td>This is the fifth batch</td>
<td>12566</td>
<td>False</td>
</tr>
</tbody>
</table>

Anyone want to give me a hand???
Jul 20 '05 #1
3 2239
In article <MP************ ************@ne ws-server.austin.r r.com>,
mr*****@protcto randgamble.com says...
Very new to XML style sheets and need some help getting this XML:

Go it...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:styleshe et version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table cellspacing="0" cellpadding="0" width="300">
<thead>
<tr>
<th scope="colgroup " colspan="3">CDS Logger Error Messages</th>
</tr>
<tr>
<th scope="col" width="100"><di v align="left">Ba tch Name</div></th>
<th scope="col" width="100"><di v align="left">Er ror Code</div></th>
<th scope="col" width="100"><di v align="left">Su ccess</div></th>
</tr>
</thead>
<tbody>
<xsl:for-each select="CDSLogg er/ErrorObject">
<!-- Sorts by ErrorCode-->
<xsl:sort select="ErrorCo de"/>
<tr height="15">
<td height="15" width="100"><di v align="left"><x sl:value-of
select="BatchNa me" /></div></td>
<td height="15" width="100"><di v align="left"><x sl:value-of
select="ErrorCo de" /></div></td>
<td height="15" width="100"><di v align="left"><x sl:value-of
select="Success " /></div></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Jul 20 '05 #2
Mr. Clean wrote:
Very new to XML style sheets and need some help getting this XML:
[bunch of XML source removed]
to look like this HTML:
[lots of HTML code removed]

Anyone want to give me a hand???


Where's the results of work you've done this far? Surely you don't
expect us to do your work, do you? Hopefully this isn't some homework
you're too lazy to do yourself....

Here's something I won't bother testing. Perhaps it helps you, perhaps
it doesn't. By the way, XSTL is really for XML->XML transforms so you
cannot easily generate HTML, only XHTML [fragments]. And the
pseudo-(X)HTML code you provided was broken but I didn't bother fixing
it either.

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<!-- Copyright (c) 2003 Mikko Rantalainen, this
code can be distributed under GPL.
TODO: fix the colgroup element(s).
-->
<xsl:template match="/">
<table>
<colgroup>
<colgroup span="3">
<thead>
<tr>
<th scope="colgroup " colspan="3">CDS Logger Error Messeges</th>
</tr>
<tr>
<th scope="col">Bat ch Name</th>
<th scope="col">Err or Code</th>
<th scope="col">Suc cess</th>
</tr>
</thead>
<tbody>

<xsl:apply-templates select="//ErrorObject">
</xsl:apply-templates>

</tbody>
</table>
</xsl:template><!-- match / -->

<xsl:template match="ErrorObj ect">
<tr>
<td><xsl:valu e-of select="BatchNa me" /></td>
<td><xsl:valu e-of select="ErrorCo de" /></td>
<td><xsl:valu e-of select="Success " /></td>
</tr>
</xsl:template><!-- match ErrorObject -->

<xsl:template match="*">
<div>UNKNOWN: <xsl:value-of select="." /></div>
</xsl:template>

</xsl:stylesheet>

--
Mikko

Jul 20 '05 #3
Mikko Rantalainen wrote:
By the way, XSTL is really for XML->XML transforms so you
cannot easily generate HTML, only XHTML [fragments].


Nope. XSLT 1.0 defines three output modes:
* XML
* HTML
* Text
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)

Jul 20 '05 #4

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

Similar topics

4
2136
by: Pascal Sartoretti | last post by:
Hello, I am looking for a formal definition of XSLT. Either a DTD or an XML Schema, whatever. Is there such a thing ? There is for instance one for XML Schema itself at http://www.w3.org/2001/XMLSchema.dtd . My problem is that I have a big set of XSLT files which may contain errors: for instance, use of XLST features that were only in the draft XSLT norm, but which Microsoft IE still supports. A DTD or XML Schema would greatly help me...
1
3067
by: Vital Lobachevsky | last post by:
Hi! I'm absolutely newbie with XSLT. Please, help me with this example. I have simple XML document like this: <skip /> <aaa> <link url="url1" /> <link url="url2" />
1
1584
by: gsoftwares | last post by:
Hi, I have a XML string and I want to transform this xml with xsl to get a xml out put. I am trying this with java code, can any one point out where is the problem. XML file <ROWSET> <ROW num="1"> <NODE_ID>1</NODE_ID>
3
2630
by: Hai Nguyen | last post by:
I would like to know after transforming my datatables which store in dataset into XML form. Now I want to save it into a file and also create a XLST file to read it. How can I do that? Would you give me any advice or link to further my understandings. Thanks for any clues
7
1254
by: Roshawn Dawson | last post by:
Hi, I have an xslt file located in the root directory. It is used by an aspx pages in both the root directory and a subdirectory. But for some strange reason, the aspx page in the subdirectory can neither locate the xslt file or the css file needed to get the desired results. What's the problem? Can anyone help me? Thanks, Roshawn
1
1208
by: Adrian | last post by:
Hi No sure if xlst is the correct choice! or if it is how I would use it from within a windows VB application! I had XML data help in an xmlelements object and I want to format the data and display it within my VB dotnet windows application. the data is not held in a file it is received back from a web service, and I want to avoid writing it as a file and reading it back! What's the best way of doing this? any links to examples?
1
1195
by: ad | last post by:
Hi, How can I use xlst to display a xml file in asp.net?
5
1494
by: MD | last post by:
my database return the search result in the xml. I have about 100 fields with 10 records if i use the dom to parse in the browser with javascript takes about 30 seconds to generate the table with search result If i use the xlst to transform this xml document to table any faster? if not faster way to display this complicated data with 100 fields?
1
1972
by: dave_kajinsky | last post by:
Hello all, I would like to do something with xlst, perhaps I can get help from this group? Here it goes: I've got 2 files: an ascii file and a file that identifies tokens in the ascii file. For example the ascii file could be:
0
9698
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
10916
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
10299
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9436
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...
1
7836
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5684
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...
1
4495
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
4071
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.