Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów
[xsl] tworzenie styli - wyświetla się tylko tytuł - Wersja do druku

+- Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów (https://www.webmastertalk.pl)
+-- Dział: Technologie internetowe - tworzenie stron WWW (https://www.webmastertalk.pl/forum-technologie-internetowe-tworzenie-stron-www)
+--- Dział: xHTML, CSS, JavaScript (https://www.webmastertalk.pl/forum-xhtml-css-javascript)
+--- Wątek: [xsl] tworzenie styli - wyświetla się tylko tytuł (/thread-xsl-tworzenie-styli-wy%C5%9Bwietla-sie-tylko-tytul)



[xsl] tworzenie styli - wyświetla się tylko tytuł - lukaszm - 27-01-2012

Witam wszystkich Smile piszę gdyż napotkałem na pewien problem podczas tworzenia stylów xsl, liczę na waszą pomoc poniżej
plik xml
Kod:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="przyklad.xsl"?>
<firma:firma xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schematLocation="www.polciu.com.pl. przyklad.dtd"
xmlns:firma="http://www.polciu.com.pl/">

<firma:nazwa> Polciu </firma:nazwa>
<firma:dyrektor imie="aaaa" nazwisko="bbbb">
    <firma:wicedyrektor imie="cccc" nazwisko="ffff">
    </firma:wicedyrektor>
    </firma:dyrektor>
</firma:firma>

plik xsl
Kod:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:firma="http://www.polciu.com.pl/">

    <xsl:template match="/">
        <html>
  <body>
<title>
<xsl:value-of select="firma:firma/firma:nazwa"/>
</title>
  <style>
  body {font-family:Verdana, Arial, helvetica, sans-serif; font-size:large; }
  </style>
  </body>
  <body style ="background-color:#EEEEEE">
  <center>
  <h2>
  <xsl:value-of select="firma:firma/firma:nazwa"/>
  </h2>
  <p>
    <h3>Testowa struktura firmy</h3>
  </p>
    </center>
     <xsl:value-of select="firma:firma/firma:dyrektor"/>
</body>
  </html>
  </xsl:template>



<xsl:template match="firma:dyrektor">
<SPAN STYLE="background-color:#FF5000; color:white; padding:4px">
<SPAN STYLE="font-weight:bold; color:white">
Dyrektor:
<xsl:value-of select="@imie"/> <xsl:value-of select="@nazwisko"/>
</SPAN>
</SPAN>
<xsl:apply-templates select="firma:wicedyrektor"/>
</xsl:template>

<xsl:template match="firma:wicedyrektor">
<DIV STYLE="background-color:#0B610B; color:green; padding:20px">
Wicedyrektor:
<SPAN STYLE="font-weight:bold; color:white">
<xsl:value-of select="@imie"/> <xsl:value-of select="@nazwisko"/>
</SPAN>
</DIV>
</xsl:template>

</xsl:stylesheet>
Problem polega na tym że wyświetla mi się tylko nazwa firmy i Testowa struktura firmy na szarym tle. Nie mam pomysłu czemu nie chce pojawić się reszta. Poniżej zamieszczę jeszcze
plik dtd
Kod:
<!ELEMENT firma:dyrektor ( firma:wicedyrektor ) >
<!ATTLIST firma:dyrektor imie NMTOKEN #REQUIRED >
<!ATTLIST firma:dyrektor nazwisko NMTOKEN #REQUIRED >

<!ELEMENT firma:firma ( firma:nazwa, firma:dyrektor ) >
<!ATTLIST firma:firma xmlns:firma CDATA #REQUIRED >
<!ATTLIST firma:firma xmlns:xsi CDATA #REQUIRED >
<!ATTLIST firma:firma xsi:schematLocation CDATA #REQUIRED >

<!ELEMENT firma:nazwa ( #PCDATA ) >

<!ELEMENT firma:wicedyrektor EMPTY >
<!ATTLIST firma:wicedyrektor imie NMTOKEN #REQUIRED >
<!ATTLIST firma:wicedyrektor nazwisko NMTOKEN #REQUIRED >



RE: [xsl] tworzenie styli - wyświetla się tylko tytuł - Pedro84 - 27-01-2012

Możliwe, że dlatego, że zrobiłeś lekką sieczkę w XSL.

Zobacz sobie tutaj: http://www.quackit.com/xml/tutorial/xslt_example.cfm


RE: [xsl] tworzenie styli - wyświetla się tylko tytuł - lukaszm - 28-01-2012

(27-01-2012, 15:37)Pedro84 napisał(a): Możliwe, że dlatego, że zrobiłeś lekką sieczkę w XSL.

Zobacz sobie tutaj: http://www.quackit.com/xml/tutorial/xslt_example.cfm
czemu tak uważasz?



RE: [xsl] tworzenie styli - wyświetla się tylko tytuł - Pedro84 - 28-01-2012

Znaczniki body, mieszasz z divami i spanami choćby.