473,699 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML >> XSL

Hi All!
I'm completly green at using XML/XSL and have a small problem...
I have a XML file that is generated by my application. It looks like this:
<PLANETS>
<PLANET>
<NAME>Eartch</PLANET>
<INFO>
<COLOR>Blue</COLOR>
<WEIGHT>1687323 72</WEIGHT>
</INFO>
</PLANET>
<PLANET>
<NAME>Mars</PLANET>
<INFO>
<COLOR>Red</COLOR>
<WEIGHT>7589483 7857</WEIGHT>
</INFO>
</PLANET>
</PLANETS>

I need to use XSL to present it on a web page like this:
1.You open my wep page and see
Eartch
Mars
2.When you klick on one of the names it should change to:
Eartch
Blue
168732372
Mars

So as you can see I need something like a hiden menu/normal node in XML (it
would be perfect) but it have to be created with XSL file (becouse some of
them should be normal links)

Any suggestions?

Zurg
Nov 12 '05 #1
4 1383
Applying and XSLT to generate the DHTML to behave like you described is
pretty much standard. Do you know what the resulting DHTML should be?

It's pretty straight forward to develop an XSLT with a template rule like
this:

<template match="PLANET">

<!-- template code goes in here -->

</template>

Take a look at [0] for some tutorials on XSL and XSLT snippets that may help
your endeavor. If you post the DHTML you want, then we might be able to help
more.

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

[0] http://www.topxml.com/xsl/default.asp

"zurg" <zu*****@wp.p l> wrote in message
news:OG******** ******@TK2MSFTN GP09.phx.gbl...
Hi All!
I'm completly green at using XML/XSL and have a small problem...
I have a XML file that is generated by my application. It looks like this:
<PLANETS>
<PLANET>
<NAME>Eartch</PLANET>
<INFO>
<COLOR>Blue</COLOR>
<WEIGHT>1687323 72</WEIGHT>
</INFO>
</PLANET>
<PLANET>
<NAME>Mars</PLANET>
<INFO>
<COLOR>Red</COLOR>
<WEIGHT>7589483 7857</WEIGHT>
</INFO>
</PLANET>
</PLANETS>

I need to use XSL to present it on a web page like this:
1.You open my wep page and see
Eartch
Mars
2.When you klick on one of the names it should change to:
Eartch
Blue
168732372
Mars

So as you can see I need something like a hiden menu/normal node in XML (it would be perfect) but it have to be created with XSL file (becouse some of
them should be normal links)

Any suggestions?

Zurg

Nov 12 '05 #2
Thanks for the link... I'm studing...
but as I said I'm completly green and it will take same time...
If you could look at my code and give me any idea I
would be really greatfull...

That's XML file:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<?xml-stylesheet type='text/xsl' href='menu.xsl' ?>
<Menu>
<COMPUTER>
<NAME>Computer1 </NAME>
<LINE>
<INF>Hard Drives</INF>
<ADRESS>..\Data \Computer1_driv es.xml</ADRESS>
</LINE>
<LINE>
<INF>Errors Log</INF>
<ADRESS>..\Data \Computer1_Err. xml</ADRESS>
</LINE>
</COMPUTER>
<COMPUTER>
<NAME>Computer2 </NAME>
<LINE>
<INF>Hard Drives</INF>
<ADRESS>..\Data \Computer2_driv es.xml</ADRESS>
</LINE>
<LINE>
<INF>Errors Log</INF>
<ADRESS>..\Data \Computer2_Err. xml</ADRESS>
</LINE>
</COMPUTER>
</Menu>

and XSL file:

<?xml version='1.0' encoding='UTF-8' ?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output media-type="text/html" />
<xsl:template match="LINE">

<HTML><body bgcolor="#FEE7B 5">
<p><a target="podstaw owa" href="{ADRESS}" style="text-decoration:
none"><font face="Verdana"

color="#1B70E2" style="font-size: 9pt"><xsl:valu e-of
select="INF"/></font></a></p>

</body>
</HTML>

</xsl:template>
</xsl:stylesheet>
And the effect when you open XML look like this:

Computer1
Hard Drives //that's a link

Errors Log //that's a link

Computer2
Hard Drives //that's a link

Errors Log //that's a link

What I need is something that would look like this:

Computer1

Computer2

And when you click on one of the Computers (or a image close to them or
anything...) the Hard Drivers and Error Logs should disapear/apear... like
cliking on the "Computer1" :
Computer1
Hard Drives //that's a link

Errors Log //that's a link

Computer2

The main problem is that I've got no idea how many computers will be in the
XML file because it would be generated by a application...
You have any suggestion please let me know...
Nov 12 '05 #3
I don't remember enough (D)HTML to get the exact code for the expand effect
with DIVs right now. You are on the right path, but your stylesheet needs to
generate a DIV around ComputerX and add an onClick handler to expand or
collapse the DIV. Only Computer elements need that extra code, so you could
check the value of the INF element to generate the correct code.

If you are using ASP.NET, then a much simpler approach would be to just
download a TreeView control, for example from [0] or [1]

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

[0] http://www.asp.net/ControlGallery/de...=28&tabindex=2
[1]
http://www.asp.net/ControlGallery/Co...=75&tabindex=2

"zurg" <zu*****@wp.p l> wrote in message
news:OC******** ******@TK2MSFTN GP09.phx.gbl...
Thanks for the link... I'm studing...
but as I said I'm completly green and it will take same time...
If you could look at my code and give me any idea I
would be really greatfull...

That's XML file:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<?xml-stylesheet type='text/xsl' href='menu.xsl' ?>
<Menu>
<COMPUTER>
<NAME>Computer1 </NAME>
<LINE>
<INF>Hard Drives</INF>
<ADRESS>..\Data \Computer1_driv es.xml</ADRESS>
</LINE>
<LINE>
<INF>Errors Log</INF>
<ADRESS>..\Data \Computer1_Err. xml</ADRESS>
</LINE>
</COMPUTER>
<COMPUTER>
<NAME>Computer2 </NAME>
<LINE>
<INF>Hard Drives</INF>
<ADRESS>..\Data \Computer2_driv es.xml</ADRESS>
</LINE>
<LINE>
<INF>Errors Log</INF>
<ADRESS>..\Data \Computer2_Err. xml</ADRESS>
</LINE>
</COMPUTER>
</Menu>

and XSL file:

<?xml version='1.0' encoding='UTF-8' ?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output media-type="text/html" />
<xsl:template match="LINE">

<HTML><body bgcolor="#FEE7B 5">
<p><a target="podstaw owa" href="{ADRESS}" style="text-decoration:
none"><font face="Verdana"

color="#1B70E2" style="font-size: 9pt"><xsl:valu e-of
select="INF"/></font></a></p>

</body>
</HTML>

</xsl:template>
</xsl:stylesheet>
And the effect when you open XML look like this:

Computer1
Hard Drives //that's a link

Errors Log //that's a link

Computer2
Hard Drives //that's a link

Errors Log //that's a link

What I need is something that would look like this:

Computer1

Computer2

And when you click on one of the Computers (or a image close to them or
anything...) the Hard Drivers and Error Logs should disapear/apear... like
cliking on the "Computer1" :
Computer1
Hard Drives //that's a link

Errors Log //that's a link

Computer2

The main problem is that I've got no idea how many computers will be in the XML file because it would be generated by a application...
You have any suggestion please let me know...

Nov 12 '05 #4
Thanks for all!
It seems that I won't be green in XML any more...
I've just realised how many things I can do with XML...
There's lot of work ahead of me...
And I just wantedgenerated an XML file to show the results of my VB.NET
app;))))

Thank once again,
zurg

U¿ytkownik "Christoph Schittko [MVP]" <ch************ ********@austin .rr.com>
napisa³ w wiadomo¶ci news:eV******** ******@TK2MSFTN GP11.phx.gbl...
I don't remember enough (D)HTML to get the exact code for the expand effect with DIVs right now. You are on the right path, but your stylesheet needs to generate a DIV around ComputerX and add an onClick handler to expand or
collapse the DIV. Only Computer elements need that extra code, so you could check the value of the INF element to generate the correct code.

If you are using ASP.NET, then a much simpler approach would be to just
download a TreeView control, for example from [0] or [1]

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

[0] http://www.asp.net/ControlGallery/de...=28&tabindex=2
[1]
http://www.asp.net/ControlGallery/Co...=75&tabindex=2

"zurg" <zu*****@wp.p l> wrote in message
news:OC******** ******@TK2MSFTN GP09.phx.gbl...
Thanks for the link... I'm studing...
but as I said I'm completly green and it will take same time...
If you could look at my code and give me any idea I
would be really greatfull...

That's XML file:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<?xml-stylesheet type='text/xsl' href='menu.xsl' ?>
<Menu>
<COMPUTER>
<NAME>Computer1 </NAME>
<LINE>
<INF>Hard Drives</INF>
<ADRESS>..\Data \Computer1_driv es.xml</ADRESS>
</LINE>
<LINE>
<INF>Errors Log</INF>
<ADRESS>..\Data \Computer1_Err. xml</ADRESS>
</LINE>
</COMPUTER>
<COMPUTER>
<NAME>Computer2 </NAME>
<LINE>
<INF>Hard Drives</INF>
<ADRESS>..\Data \Computer2_driv es.xml</ADRESS>
</LINE>
<LINE>
<INF>Errors Log</INF>
<ADRESS>..\Data \Computer2_Err. xml</ADRESS>
</LINE>
</COMPUTER>
</Menu>

and XSL file:

<?xml version='1.0' encoding='UTF-8' ?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output media-type="text/html" />
<xsl:template match="LINE">

<HTML><body bgcolor="#FEE7B 5">
<p><a target="podstaw owa" href="{ADRESS}" style="text-decoration:
none"><font face="Verdana"

color="#1B70E2" style="font-size: 9pt"><xsl:valu e-of
select="INF"/></font></a></p>

</body>
</HTML>

</xsl:template>
</xsl:stylesheet>
And the effect when you open XML look like this:

Computer1
Hard Drives //that's a link

Errors Log //that's a link

Computer2
Hard Drives //that's a link

Errors Log //that's a link

What I need is something that would look like this:

Computer1

Computer2

And when you click on one of the Computers (or a image close to them or
anything...) the Hard Drivers and Error Logs should disapear/apear... like cliking on the "Computer1" :
Computer1
Hard Drives //that's a link

Errors Log //that's a link

Computer2

The main problem is that I've got no idea how many computers will be in

the
XML file because it would be generated by a application...
You have any suggestion please let me know...


Nov 12 '05 #5

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

Similar topics

9
2959
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> ----------------//----------------------
1
6822
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
3214
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are writing one object in C# which will take the entire table tag contents and renders. Ie., we need to pass "<table>………… <thead>……</thead>. <tr>.<td> <td>..<tr>.<td> <td> </table>" content to
2
10559
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
0
2061
by: Arne Schirmacher | last post by:
I want to display a MySQL database field that can contain HTML markup. If I use <esql:get-string> then I get all of the database field, but all tags are escaped which is not what I want. If I use <esql:get-xml> the tags are not escaped, but only the first part of the database field is displayed. The content of the database field is: "<h1>Title</h1><h2>Subtitle</h2>"
34
11051
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some reason, there's an annoying vertical gap between adjacent rules that doesn't go away. This looks like IE6 is incorrectly setting the margin to some arbitrary value. Does anyone know if this is a known bug at MS? If you know of one, post the...
11
13706
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom, there's an "Edit" link. So the page itself looks something like this: <HTML><HEAD><TITLE>blah</TITLE></HEAD><BODY> <!-- TEXT STARTS HERE --> <H1>Hello World!</H1> <P>More stuff here...</P>
2
2448
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the XML file will get their row content from there. The rows may look some thing similar to this: - Added <a>mailing list</a> functionality to <a>homepage</a> - Competition winners announced, click <a>here</a>
0
1090
by: vdex42 | last post by:
Apologies if this has been asked before, but I haven't been able to find the answer to this yet: My problem is that .NET will not allow me to insert escaped '>' characters (i.e. &gt;) within the text property of asp buttons, it seems to strip out only those type of characters, because other escape codes DO work (eg. &quote;) For example <asp:button Runat=server text="test &gt;" ID=txtTest></asp:button>
5
2654
by: John Nagle | last post by:
This, which is from a real web site, went into BeautifulSoup: <param name="movie" value="/images/offersBanners/sw04.swf?binfot=We offer fantastic rates for selected weeks or days!!&blinkt=Click here And this came out, via prettify: <addresssnippet siteurl="http%3A//apartmentsapart.com" url="http%3A//www.apartmentsapart.com/Europe/Spain/Madrid/FAQ"> <param name="movie" value="/images/offersBanners/sw04.swf?binfot=We offer
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
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
7745
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
6532
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
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
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
3054
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
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
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.