Hello. I've successfully extracted and transformed everything I need from a particular XML file with the exception of one item. I have been agonizing over this for days and nothing I do seems to work. Any help would be greatly appreciated. Here is a sample of the XML code:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<allscores>
<League league_name="AL East" league_id="ALE">
<team team_id="141" team_name="Toronto Blue Jays">
<game_date>04/08/2009</game_date>
<game_score>11-05</game_score>
</team>
<team team_id="167" team_name="Baltimore Orioles">
<game_date>04/08/2009</game_date>
<game_score>06-09</game_score>
</team>
</League>
<League league_name="NL East" league_id="NLE">
<team team_id="211" team_name="New York Mets">
<game_date>04/08/2009</game_date>
<game_score>14-07</game_score>
</team>
<team team_id="213" team_name="Florida Marlins">
<game_date>04/08/2009</game_date>
<game_score>00-01</game_score>
</team>
</League>
</allscores>
Here is sample of my XSL code:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:template match="/allscores">
<ROOT xmlns:dt="urn:schemas-microsoft-com:datatypes">
<Scores>
<xsl:for-each select="/allscores/League/team">
<LeagueID>
<xsl:value-of select="/League/@league_id"/>
</LeagueID>
<Team>
<TeamCode>
<xsl:value-of select="@team_id"/>
</TeamCode>
<TeamName>
<xsl:value-of select="@team_name"/>
</TeamName>
<Date>
<xsl:attribute name="dt:dt">string</xsl:attribute>
<xsl:value-of select="game_date"/>
</Date>
<Score>
<xsl:attribute name="dt:dt">string</xsl:attribute>
<xsl:value-of select="game_score"/>
</Score>
</Team>
</xsl:for-each>
</Scores>
</ROOT>
</xsl:template>
</xsl:stylesheet>
Everything works with the exception of league_id:
Code:
<LeagueID>
<xsl:value-of select="/League/@league_id"/>
</LeagueID>
Whether I place this snippet inside or outside of <Team>, the output remains empty each time. I have even tried the entire path (/allscores/League/@league_id) in both places but the output is still empty.
Any ideas?