Thomas J.S.: XML Abfrage

Beitrag lesen

hallo,

oh mann tut mir leid, ich hatte hier schonmal was gefragt, da kam die antwort ziemlich fix .. so 5 mins später

ja, aber bedenke was du fragst: "bastele mal mir schnell eine komplette xsl datei", so flott geht das nun mal nicht, wie eine kleine css frage.

die frage ist wie und was du machen willst.
ich gabe davon aus, dass du auf die von der verlinke xml datei "http://www.camelot-europe.com/herald/servers/Avalon//guilds/588.xml"
keinen enfluss hast und dass du die darstellung clientseitig also vom browser (nur IE und Mozilla) ausführen lassen willst.
also habe ich dir mal schnell was gebastelt.

stelle die dateien auswertung.xml und ausvertung.xsl auf dmeinem webspace und dann kannst du direkt auf die auswertung.xml verlinken.
den rest muss du schon alleine schaffen.

-------auswertung.xml---------
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="auswertung.xsl"?>
<auswertung>
</auswertung>
-------------------------------

-------auswertung.xsl----------
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/auswertung">
      <html>
         <xsl:apply-templates select="document('http://www.camelot-europe.com/herald/servers/Avalon//guilds/588.xml')"/>
      </html>
   </xsl:template>

<xsl:template match="guild_status">
      <head>
       <title>Willkommen auf der Homepage der Gilde <xsl:value-of select="guild/@name" /></title>
      </head>
      <body>
         <h1>Willkommen auf der Homepage der Gilde <xsl:value-of select="guild/@name" /></h1>
         xsl:apply-templates/
      </body>
   </xsl:template>

<xsl:template match="guild">
      <table width="100%" cellpadding="2" cellspacing="0" border="1">
         <tr>
            <td>
               <img src="{@sshield}" />
            </td>
            <td>Name der Gilde:
               <a href="{@wesiteurl}"><xsl:value-of select="@name" /></a>
            </td>
            <td>Realm: <xsl:value-of select="@realm" /></td>
            <td>Aktive Charakters: <xsl:value-of select="@activechars" /></td>
            <td>Aktive Mitglieder: <xsl:value-of select="@activemembers" /></td>
            <td>guildrp: <xsl:value-of select="@guildrp" /></td>
            <td>Kontakt:
               <a href="mailto:{@contacturl}"><xsl:value-of select="@contacturl" /></a>
            </td>
            <td>Allianzen: <xsl:value-of select="@alliance" /></td>
            <td>
               <img src="{@semblem}" />
            </td>
         </tr>
      </table>
     <br />
     <br />

<xsl:for-each select="character">
      <table width="90%" cellpadding="0" cellspacing="0" border="0">
         <tr>
            <th colspan="7" align="left"><xsl:value-of select="@name" /> (zuletzt online: <xsl:value-of select="@laston" />)</th>
         </tr>
         <tr>
            <td>Rasse: <xsl:value-of select="race" /></td>
            <td>Klasse: <xsl:value-of select="class" /></td>
            <td>Level: <xsl:value-of select="level" /></td>
            <td>Ranking: <xsl:value-of select="guildrank" /></td>
            <td>Total RP: <xsl:value-of select="totalrp" /></td>
            <td>RP letze Woche: <xsl:value-of select="lastweekrp" /></td>
            <td>anon: <xsl:value-of select="anon" /></td>
         </tr>
      </table>
      <br /><hr /><br />
     </xsl:for-each>
     <xsl:apply-templates select="alliancelist"/>

<h1>Top-Spieler</h1>
     <xsl:apply-templates select="top"/>
   </xsl:template>

<xsl:template match="alliancelist">
      <h1>Allianzen</h1>
      <xsl:for-each select="alliancemember">
         <ul>
         <li>Name: <xsl:value-of select="alname" /></li>
         <li>ID: <xsl:value-of select="alguildid" /></li>
         <li>RP: <xsl:value-of select="altotalrp" /></li>
         </ul>
      </xsl:for-each>
   </xsl:template>

<xsl:template match="top">
      <dl>
       <dt>Tpye: <xsl:value-of select="@type" /></dt>
         <xsl:for-each select="top_char">
            <dd>Name: <xsl:value-of select="@name" /> - Punkte: <xsl:value-of select="@point" /></dd>
         </xsl:for-each>
      </dl>
      <br />
   </xsl:template>

</xsl:stylesheet>
-----------------------

grüße
thomas