Click to See Complete Forum and Search --> : Xml / Xsl


StevenHickerson
July 31st, 2002, 02:42 PM
Hi I'm having a problem with using the XML and XML Transformers to display info from an XML file. I followed the example but it dosn't work quite right for this XML file.

I have a file similiar to this (shortened up though)

<?xml version="1.0"?>
<!DOCTYPE guild_status SYSTEM "http://www.camelotherald.com/mythic.dtd">

<guild_status>

<guild name="Cult of Nyarlathotep" realm="Hibernia"
activechars="131" activemembers="73"
guildrp="6350677" guildlastrp="543643" contacturl="daoc_cultists@hotmail.com"
Websiteurl="http://www.cultofnyar.com" timestamp="2002-07-
31 00:56:23" sshield="http://www.camelotherald.com/shields/0-
5-2-full.png"
semblem="http://www.camelotherald.com/realms/insignia/h_embl
em_030.gif" alliance="885" keepowned="Dun Scathaig (difficulty:
1)" realultimatepower="0">
<character name="Bitah" laston="Recently">
<race>Lurikeen</race>
<class>Nightshade</class>
<level>50</level>
<guildrank>2</guildrank>
<totalrp>422849</totalrp>
<lastweekrp>30887</lastweekrp>
<totalkills>0</totalkills>
<totaldeaths>0</totaldeaths>
<anon>True</anon>
</character>
</guild>
</guild_status>


First off the <!DOCTYPE line causes a name not found error or something. But I can't delete this line because when I access the file it will be on someone elses server. So thats problem 1, how to get past that line?

Next I have this XLS Transformer file.

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<HTML>
<BODY bgcolor="#000000" text="#000000">
<TABLE cellspacing="1" cellpadding="1">
<TR bgcolor="#AAAAAA">
<TD class="heading"><B>Name</B></TD>
<TD class="heading"><B>Level</B></TD>
<TD class="heading"><B>Class</B></TD>
<TD class="heading"><B>Race</B></TD>
<td class="heading"><B>TotalRps</B></td>
</TR>
<xsl:for-each select="guild_status">
<xsl:for-each select="guild/character">
<TR bgcolor="#DDDDDD">
<TD width="25%" valign="top">
<xsl:value-of select="name"/>
</TD>
<TD width="20%" valign="top">
<xsl:value-of select="level"/>
</TD>
<TD width="25%" valign="top">
<xsl:value-of select="class"/>
</TD>
<TD width="15%" valign="top">
<xsl:value-of select="race"/>
</TD>
<td width = "15%" valign="top">
<xsl:value-of select="totalrp"/>
</td>
</TR>
</xsl:for-each>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>


Now this works except for the Name. So problem 2 is how do I get the name out of then <character name="Bitah" last_on="Recently">?

And then is there anywhere I can find more info about this particular type of stuff? I'm going to want to add in being able to resort the list by each column, and have expanding and contracting nodes for each character based off of another file saying wich characters are alts to wich characters.

Right now I do this (about 130 characters) using PHP. If your interested in seeing that and getting an idea of what I want to be able to do go over to http://www.swhweb.com/Cult/roster.shtml

The reason I want to switch to this is because the PHP is slow, and it gives me a chance to learn how to do something in VB.net. Lol never thought when I bought VB.net that things changed this much and I was gonna have to learn other languages to get what I wanted done :)

Thanks for any help you can give

Steven