|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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"/> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > how do I... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|