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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 1st, 2002, 01:46 AM
getchoo getchoo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 20 getchoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
how do I...

I have the following xml file

<?xml version="1.0"?>

<anime_titles>
<anime type="Television Series" picture="noimage.bmp">
<title>X</title>
<aka>X TV</aka>
<numOfEps>24</numOfEps>
<year>2001</year>
<studio>Bandai Visual</studio>
<studio>CLAMP</studio>
<studio>Kadokawa Shoten</studio>
<studio>Madhouse Production</studio>
<US_distro>Pioneer Animation</US_distro>
<description>
It is the Year of Destiny: 1999. The concluding battle to determine the fate of humanity has begun. The forces of the Dragon of Heaven - the protectors of the earth - face off against those who align themselves with the Dragon of Earth who wish to wish to devestate the planet to bring about a "purification". In the middle is Kamui Shirou, in his hands rests the fate of earth and its population. Will Kamui side with the Dragon of Heaven or the Dragon of Earth?
</description>
</anime>
<anime type="Television Series" picture="noimage.bmp">
<title>Trigun</title>
<numOfEps>26</numOfEps>
<year>1998</year>
<studio>Madhouse Production</studio>
<US_distro>Pioneer Animation</US_distro>
<description>
Vash The Stampede - a.k.a. the Humanoid Typhoon - has a 60 billion bounty on his head. Unfortunately for his potential captors - and luckly for Vash - nobody knows what he looks like. Where ever Vash goes he seems to bring with him mass destruction and now two FIA inspectors - Milly Thompson and Meryl Strife - have been dispatched to investigate Vash the Stampede and collect from him the costs of all the damage he has caused. Now Vash must deal with both the bounty hunters out to collect the enormous price on his head AND the insurance inspectors who are out to collect the enormous debt he owes. But still one question remains: "Who is Vash The Stampede?"
</description>
</anime>
</anime_titles>



there are multiple occurences of studio for each anime_title and I want to display all the studios for each anime title. So I created the following xlt file

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY BGCOLOR="666666">
<P><FONT COLOR="BLACK"><STRONG>ANIME SERIES</STRONG></FONT></P>
<xsl:for-each select="anime_titles/anime">
<TABLE BORDER="0" WIDTH="800">
<TR><TD><IMG><xsl:attribute name="SRC"><xsl:value-of select="./@picture"/></xsl:attribute></IMG></TD>
<TD>
<TABLE BORDER="0" WIDTH="640">
<TR><TD WIDTH="80"><STRONG>TITLE</STRONG></TD><TD><xsl:value-of select="title"/></TD></TR>
<TR><TD WIDTH="80"><STRONG>TYPE</STRONG></TD><TD><xsl:value-of select="@type"/></TD></TR>
<TR><TD WIDTH="80"><STRONG>A.K.A.</STRONG></TD><TD><xsl:value-of select="aka"/></TD></TR>
<TR><TD WIDTH="80"><STRONG>Number Of Episodes</STRONG></TD><TD><xsl:value-of select="numOfEps"/></TD></TR>
<TR><TD WIDTH="80"><STRONG><P TEXT-ALIGN="TOP">Studio(s)</P></STRONG></TD><TD>
<xsl:for-each select="anime/studio">
<P><xsl:value-of select="./studio"/></P>
</xsl:for-each>
</TD></TR>
<TR><TD WIDTH="80"><STRONG>US Distributor</STRONG></TD><TD><xsl:value-of select="US_distro"/></TD></TR>
<TR><TD WIDTH="80"><STRONG>Description</STRONG></TD><TD><xsl:value-of select="description"/></TD></TR>
</TABLE>
</TD>
</TR>
</TABLE>
<P><FONT COLOR="BLACK"><CENTER>_______________________</CENTER></FONT></P>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

however for the first anime title its displaying only the first studio "Bandai Studio" four times instead of
Bandai Visual, CLAMP,Kadowaka and Madhouse Production
What is the problem with the code?

Please help

getchoo

Reply With Quote
  #2  
Old August 1st, 2002, 03:42 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Try making:

<xsl:for-each select="anime/studio">
<P><xsl:value-of select="./studio"/></P>
</xsl:for-each>

into:

<xsl:for-each select="./studio">
<P><xsl:value-of select="."/></P>
</xsl:for-each>

If that doesn't work, I'd try using a seperate template to process studio elements, and replace the above with:
<xsl:apply-templates select="studio"/>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > how do I...


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 4 hosted by Hostway