Thema: Delphi XSL Problem

Einzelnen Beitrag anzeigen

Mussi0

Registriert seit: 8. Jun 2006
55 Beiträge
 
#1

XSL Problem

  Alt 27. Aug 2007, 20:00
Hallo zusammen,

ich habe ein Problem mit einem XSL-Template und habe ich folgende XML Datei:

XML-Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<catalog>
  <cd num="0">
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <preis>
         <npreis id="0">10</npreis>
         <nstaffel id="0">1</nstaffel>      
         <npreis id="1">8</npreis>
         <nstaffel id="1">2</nstaffel>            
    </preis>
    <year>1985</year>
  </cd>
  <cd num="1">
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <preis>
         <npreis id="0">20</npreis>
         <nstaffel id="0">1</nstaffel>      
         <npreis id="1">16</npreis>
         <nstaffel id="1">2</nstaffel>            
    </preis>
    <year>1985</year>
  </cd>
  <cd num="2">
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <preis>
         <npreis id="0">30</npreis>
         <nstaffel id="0">1</nstaffel>      
         <npreis id="1">24</npreis>
         <nstaffel id="1">2</nstaffel>            
    </preis>
    <year>1985</year>
  </cd>
</catalog>
Und folgende XSL Datei:

XML-Code:
<?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="/">
  <html>
  <body>
    <h2>My CD Collection</h2>
    <table border="1">
    <tr bgcolor="#AAAAAA">
      <th align="left">Title</th>
      <th align="left">Artist</th>
      <th align="left">Preis</th>
      <th align="left">Staffel Preis</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <td><xsl:value-of select="artist"/></td>
      <xsl:for-each select="preis">
            <xsl:if test="catalog/cd/preis/nstaffel[@id='1']">
               <td colspan="2"></td>
             </xsl:if>
         <td><xsl:value-of select="npreis"/></td>
            <td><xsl:value-of select="nstaffel"/></td>
         </xsl:for-each>
    </tr>
    </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>
Nun möchte ich zu jeden Artist beide Preise bekommen und zwar untereinander.

Leider funktioniert das so wie ich das gemacht habe nicht und ich weiß nicht warum!!

Gruß und Dank für eure Hilfe!!!

muss!0
Wer die anderen neben sich klein macht ist nie groß.
von Johann Gottfried Seume

Website: http://mussio.funpic.de
  Mit Zitat antworten Zitat