XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 16th, 2004, 03:00 PM
nico8426 nico8426 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 nico8426 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
help for xslt

hi,
i would like to create a xslt document which permit to display datas but with a selection through a drop down list.
my xml file is quite simple, it looks like this:
<a>
<b>
<c>name</c>
<d>details</d>
<d>details2</d>
</b>
<b>...</b>
</a>
i would like to put all the names in a drop down list and after selection display all the details.
if someone can help me or tell me where i can find examples, he is welcome. i guess it's not too complicated for a specialist but i'm a beginner.
thank you
bye

Reply With Quote
  #2  
Old January 16th, 2004, 03:27 PM
fpmurphy fpmurphy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 262 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 28 m 59 sec
Reputation Power: 6
There is no such thing as an XSLT document. What I suspect is
that you want to take your XML file and construct an XHTML file from that XML file using XSLT.

For a basic understanding of the process, have a look at:

www.w3schools.com/xsl/xsl_transformation.asp

- Finnbarr

Reply With Quote
  #3  
Old January 17th, 2004, 01:56 PM
nico8426 nico8426 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 nico8426 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
re

yes
you're right that's exactly what i want to do.
i have already had a look to the documentation you talked about, but my problem concerns patterns in the xpath expression and the xsl:for-each and xsl:value-of. I don't know how to include the selection by drop-down list

Reply With Quote
  #4  
Old January 19th, 2004, 03:42 PM
imillar imillar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Toronto Canada
Posts: 7 imillar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to imillar
Try this:

<select name="cmbName">
<xsl:for-each select="a/b/child::node()">
<option value="value"><xsl:value-of select="." /></option>
</xsl:for-each>
</select>

Reply With Quote
  #5  
Old January 19th, 2004, 03:48 PM
imillar imillar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Toronto Canada
Posts: 7 imillar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to imillar
Try this:

<select name="cmbName">
<xsl:for-each select="a/b/child::node()">
<option value="value"><xsl:value-of select="." /></option>
</xsl:for-each>
</select>

Reply With Quote
  #6  
Old January 21st, 2004, 03:50 PM
nico8426 nico8426 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 nico8426 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
it doesn't work, it doesn't like the double :, what does mean this expression "child::node()"? and in your program, i don't explain what i want to display in the drop down and after selection??

Reply With Quote
  #7  
Old January 23rd, 2004, 12:13 AM
fpmurphy fpmurphy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 262 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 28 m 59 sec
Reputation Power: 6
child::node() selects all the children of the current (context)
node.

Here is a simple working example of how to create the
dropdown list for the names.

Assuming the following XML file:

<a>
<b>
<c>name1</c>
<d>details10</d>
<d>details11</d>
</b>
<b>
<c>name2</c>
<d>details20</d>
<d>details21</d>
</b>
<b>
<c>name3</c>
<d>details30</d>
<d>details31</d>
</b>
<b>
<c>name4</c>
<d>details40</d>
<d>details41</d>
</b>
</a>

The following code snippet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="yes" standalone="yes"
omit-xml-declaration="no" encoding="UTF-8"/>

<xsl:template match="/">
<html>
<body>

<select name="cmbName">
<xsl:for-each select="a/b/c">
<option value="value"><xsl:value-of select="."/></option>
</xsl:for-each>
</select>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

produces

<html>
<body>
<select name="cmbName">
<option value="value">name1</option>
<option value="value">name2</option>
<option value="value">name3</option>
<option value="value">name4</option>
</select>
</body>
</html>

Reply With Quote
  #8  
Old January 24th, 2004, 04:24 PM
nico8426 nico8426 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 nico8426 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ah ok i understand, thank you.
sorry but how do you do then to display the details <d> after selection of a name in the drop down? how do you use the value selected in the drop down?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > help for xslt


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway