Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> XML + XSL, jak wyświetlić tekst, który nie jest zawarty w znacznikach
pstawik
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 15.03.2006

Ostrzeżenie: (0%)
-----


Witam
Oto mój plik XML:
  1. <?xml version="1.0"?>
  2. <lista>
  3.      <student number = "1">
  4.            <name>Jan Kowalski</name>
  5.            <index>123456</index>
  6.            <foto>foto1.jpg</foto>
  7.            <mail>jk@prz.pl</mail>
  8.            <www>http://www.jk.pl</www>
  9.            jk text
  10.      </student>
  11.      <student number = "2">
  12.            <name>Jan Nowak</name>
  13.            <index>234567</index>
  14.            <foto>foto2.jpg</foto>
  15.            <mail>jn@prz.pl</mail>
  16.            <www>http://www.jn.pl</www>
  17.            jn text
  18.      </student>
  19. </lista>


Chce ten plik przerobic za pomocą xsl, który u mnie wygląda tak:
  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  2. <xsl:template match="lista">
  3. <html><head>Studenci</head>
  4. <body>
  5. <table border="1">
  6. <xsl:apply-templates />
  7. </table>
  8. </body>
  9. </html>
  10. </xsl:template>
  11. <xsl:template match="student">
  12. <tr>
  13. <td>number</td>
  14. <td>
  15. <xsl:apply-templates>
  16. <xsl:value-of select="@number" />
  17. </xsl:apply-templates>
  18. </td></tr>
  19. </xsl:template>
  20. <xsl:template match="name">
  21. <tr>
  22. <td>name</td>
  23. <td><xsl:apply-templates />
  24. </td></tr>
  25. </xsl:template>
  26. <xsl:template match="index">
  27. <tr>
  28. <td>index</td>
  29. <td><xsl:apply-templates />
  30. </td></tr>
  31. </xsl:template>
  32. <xsl:template match="foto">
  33. <tr>
  34. <td>foto</td>
  35. <td><xsl:apply-templates />
  36. </td></tr>
  37. </xsl:template>
  38. <xsl:template match="mail">
  39. <tr>
  40. <td>mail</td>
  41. <td><xsl:apply-templates />
  42. </td></tr>
  43. </xsl:template>
  44. <xsl:template match="www">
  45. <tr>
  46. <td>www</td>
  47. <td><xsl:apply-templates />
  48. </td></tr>
  49. </xsl:template>
  50. </xsl:stylesheet>


Wszystko się wyświetla w porządku, ale nie mam pojęcia jak wyświetlić ten tekst, który nie jest zawarty w znacznikach? Nie moge go umieścić w znacznikach, gdyż takie właśnie mam zadanie i tu polega trudność. Już parenaście godzin szukam na necie i nic nie ma jak sie obługuję takie pola.
Z góry dziękuję za pomoc (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

Posty w temacie
- pstawik   XML + XSL   27.12.2006, 13:25:26
- - SHARKI   a kto Ci powiedział ze tak sie da   29.04.2007, 23:09:45
- - Łukasz O.   [XML] pobierz, plaintext <xsl:stylesheet versio...   30.04.2007, 00:59:12


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.09.2025 - 06:31