Article View: pl.comp.xml
Article #13Odp: XML jeszcze raz
From: Maciej Jankowski
Date: Wed, 30 Aug 2000 13:24
Date: Wed, 30 Aug 2000 13:24
60 lines
2267 bytes
2267 bytes
> oto i plik ktory chce przekonwertowac na HTML
> i zeby to bylo w Tabelce najlepiej i wszystko co w Text to jest linkiem do
> podstrony...
> i co jeszcze ...zeby to chodzilo w ASP....
> ale mam wymagania...ale coz jestem poczatkujacy....i prosze o pomoc
>
Proponowal bym jednak poczytac o XSL'u.
A ponizej masz przyklad (bardzo prosty)
<?xml version="1.0" encoding="ISO-8859-2"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="/">
<HTML>
<xsl:apply-templates/>
</HTML>
</xsl:template>
<xsl:template match="headlines">
<xsl:element name="table">
<xsl:attribute name="border">1</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="headline">
<TR>
<xsl:element name="TD">
<xsl:attribute name="width">100</xsl:attribute>
<xsl:attribute name="bgcolor">yellow</xsl:attribute>
<b><xsl:value-of select="@date"/></b>
</xsl:element>
<xsl:element name="TD">
<xsl:attribute name="width">200</xsl:attribute>
<xsl:attribute name="bgcolor">white</xsl:attribute>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="href">kto_to_wie</xsl:attribute>
<xsl:value-of select="text"/>
</xsl:element>
</TR>
</xsl:template>
</xsl:stylesheet>
Maciek
PS
Aby plik XMLowy uzywal XSL'a
musisz dodac w naglowku pliku XML'owego linie
<?xml-stylesheet type="text/xsl" href="NAZWA_PLIKU.xsl"?>
Technical Details
Message-ID:
<8oj2am$53u$1@info.nask.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.man.poznan.pl!fargo.cgs.poznan.pl!agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!not-for-mailReferences:
<8oitmc$oka$1@news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.man.poznan.pl!fargo.cgs.poznan.pl!agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!not-for-mail From: "Maciej Jankowski" <matthet@polbox.com> Newsgroups: pl.comp.xml Subject: Odp: XML jeszcze raz Date: Wed, 30 Aug 2000 15:24:18 +0200 Organization: NASK - http://www.nask.pl Lines: 65 Message-ID: <8oj2am$53u$1@info.nask.pl> References: <8oitmc$oka$1@news.tpi.pl> NNTP-Posting-Host: gateway.mofnet.gov.pl X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit