Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   XML (https://www.delphipraxis.net/46-xml/)
-   -   Delphi XSL Problem (https://www.delphipraxis.net/98461-xsl-problem.html)

Mussi0 28. Aug 2007 13:48

Re: XSL Problem
 
Also die Staffel sagt sozusagen die Stück Anzahl aus!

z.B. bezahlst du für Bob Dylan 10€ kaufst du aber 2 Lieder von dem bezahlst du nur 8€!!
Nun kann man je nach Produkt natürlich entsprechend auch viel Staffeln siehe Bleistifte,
ein Unternehmen könnte ja z.B. 200 Bleistifte kaufen die dann nur 20 € kosten statt 10 für 1,50€!!

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>
   <preise>
        <preis staffel="1">10</preis>
        <preis staffel="2">8</preis>
        <preis staffel="4">7.50</preis>
   </preise>
    <year>1985</year>
  </cd>
  <cd num="1">
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
   <preise>
        <preis staffel="1">20</preis>
        <preis staffel="2">16</preis>
        <preis staffel="5">12</preis>
        <preis staffel="10">8</preis>
   </preise>
    <year>1985</year>
  </cd>
  <cd num="2">
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
   <preise>
        <preis staffel="1">30</preis>
        <preis staffel="2">24</preis>
   </preise>
    <year>1985</year>
  </cd>
</catalog>
Jetzt will ich natürlich trotzdem alle Preise zu alle Artists haben!

Und mit der von dir vorgeschlagenen Lösung geht das nur wenn ich die XSL verändere!

Geht das mit XSL??

Gruß

muss!0

marabu 29. Aug 2007 12:59

Re: XSL Problem
 
Hallo,

alles geht, aber du brauchst eine Idee, wie das visualisiert werden soll. Oder wartest du auf Vorschläge von mir? Versuche doch mal mit handkodiertem HTML ein Muster zu erstellen, das so aussieht, wie du dir das vorstellst und hänge das hier an. Dann bekommst du auch ein XSL-T Skript - früher oder später.

Freundliche Grüße

Mussi0 30. Aug 2007 08:01

Re: XSL Problem
 
Hi,

mir geht es nicht darum das du oder jmd. anderes mein XSL-T schreibt!!!
Ich möchte nur wissen wie ich folgendes durchgehe.

XML-Code:
...
<produkt>
  <attributbez>
    <sattributbez id="1">Typ</sattributbez>
    <sattributbez id="2">Korpus/Front</sattributbez>
    <sattributbez id="3">Gewicht in kg</sattributbez>
    <sattributbez id="4">Anzahl Fächer</sattributbez>
    <anzahl>4</anzahl>
  </attributbez>
...
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>
  <head>
  <title>Bestelltabelle</title>
  </head>
  <body>
    <table rules="all" width="200">
         <tr>      
            <xsl:apply-templates select="produkt" />            
         </tr>
    </table>
  </body>
  </html>
</xsl:template>

<xsl:template match="produkt/attributbez">
      <xsl:if test="anzahl >= sattributbez[@id]">
         <th><xsl:value-of select="sattributbez" /></th>
      </xsl:if>
</xsl:template>

</xsl:stylesheet>
Ich will einfach nur das mir die sAttributBez "variabel" je nach Anzahl der vorhanden ausgegeben wird und zwar so:

Code:
...
<tr>
 <th>Typ</th>
 <th>Korpus / Front</th>
 <th>Gewicht in kg</th>
 <th>Anzahl Fächer</th>
</tr>
...
Das funktioniert aber nicht mit dem XSL oben und deshalb hätte ich gerne einfach nur nen Tipp!!! Das ist genau das
gleiche wie mit den Preisen und Staffel die ich da vorher hatte nur halt mit diesen Eigenschaften, doch trotzdem
muss das ganze "variabel" sein!!

Gruß

muss!0

marabu 30. Aug 2007 09:05

Re: XSL Problem
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,

es gibt mehrere Möglichkeiten eine variable Anzahl von Elementen zu verarbeiten, deshalb habe ich dich nach einem Layout-Entwurf gefragt. In Abhängigkeit von diesem Layout implementiert man das XSL-T Skript. Ich habe dir mal ein Skript für folgendes Layout gebaut:

Code:
+---------+------------+------------+---
| title  | ab 1 Stück | ab 2 Stück | ...
| artist |         10 |         8  |
+---------+------------+------------+---
Ich weiß nicht wie ich dir einen Tipp geben kann ohne ein Beispiel-Skript zu erstellen. Den Iterator for-each hast du ja schon irgendwo kennen gelernt, deshalb habe ich ein passendes Layout dafür gewählt.

Freundliche Grüße

Mussi0 30. Aug 2007 10:05

Re: XSL Problem
 
Hallo,

Danke das war was ich gesucht habe ;-)

Naja war ne lange Geburt aber wahrscheinlich lag es an mir hab ja erst vor ein paar Tagen
damit angefangen und wusste daher nicht wirklich wie ich mich ausdrücken sollte bzw. was du von
mir wolltest aber es hat ja noch geklappt!!!

VIELEN DANK NOCHMAL

Gruß

Muss!0


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:50 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz