473,394 Members | 1,671 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 >> 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>168732372</WEIGHT>
</INFO>
</PLANET>
<PLANET>
<NAME>Mars</PLANET>
<INFO>
<COLOR>Red</COLOR>
<WEIGHT>75894837857</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 1364
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.pl> wrote in message
news:OG**************@TK2MSFTNGP09.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>168732372</WEIGHT>
</INFO>
</PLANET>
<PLANET>
<NAME>Mars</PLANET>
<INFO>
<COLOR>Red</COLOR>
<WEIGHT>75894837857</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_drives.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_drives.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:stylesheet 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="#FEE7B5">
<p><a target="podstawowa" href="{ADRESS}" style="text-decoration:
none"><font face="Verdana"

color="#1B70E2" style="font-size: 9pt"><xsl:value-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.pl> wrote in message
news:OC**************@TK2MSFTNGP09.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_drives.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_drives.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:stylesheet 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="#FEE7B5">
<p><a target="podstawowa" href="{ADRESS}" style="text-decoration:
none"><font face="Verdana"

color="#1B70E2" style="font-size: 9pt"><xsl:value-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**************@TK2MSFTNGP11.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.pl> wrote in message
news:OC**************@TK2MSFTNGP09.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_drives.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_drives.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:stylesheet 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="#FEE7B5">
<p><a target="podstawowa" href="{ADRESS}" style="text-decoration:
none"><font face="Verdana"

color="#1B70E2" style="font-size: 9pt"><xsl:value-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
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...
1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
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...
2
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...
0
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...
34
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...
11
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,...
2
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...
0
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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.