Wenn man heute im Web XML Dateien anbietet, und sich nicht nur an bekannte Geschäftskunden wendet, wird man wohl alternativ auch das Ergebnis der Umwandlung nach HTML anbieten müssen. Es ist aber auch möglich, daß der Web-Server die Umwandlung bei Bedarf automatisch durchführt. Der Browser schickt im Request ja auch die Information, welche Datenformate er versteht.
| <?xml version="1.0" ?> |
| <?xml-stylesheet type="text/xsl" href="books_ie.xsl" ?> |
| <BOOKLIST> |
| <BOOK ISBN="0-13-014714-1" PAGES="1074"> |
| <AUTHOR FIRST="Paul" LAST="Prescod"/> |
| <AUTHOR FIRST="Charles" MI="F." LAST="Goldfarb"/> |
| <TITLE>XML: The XML Handbook - 2nd Edition</TITLE> |
| <PUBLISHER DATE="19991112">Prentice Hall</PUBLISHER> |
| <NOTE>Contains CD.</TITLE> |
| </BOOK> |
| <BOOK ISBN="1-56592-709-5" PAGES="107"> |
| <AUTHOR FIRST="Robert" LAST="Eckstein"/> |
| <TITLE>XML Pocket Reference</TITLE> |
| <PUBLISHER DATE="19991001">O'Reilly</PUBLISHER> |
| </BOOK> |
| </BOOKLIST> |
| <?xml version="1.0" ?> |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.0"> |
| <xsl:template match="/"> |
| <HTML> |
| <HEAD><TITLE>Books About XML</TITLE></HEAD> |
| <BODY> |
| <UL> |
| <xsl:apply-templates select="/BOOKLIST/BOOK"/> |
| </UL> |
| </BODY> |
| </HTML> |
| </xsl:template> |
| <xsl:template match="BOOK"> |
| <LI><xsl:apply-templates select="AUTHOR[0]"/>:<BR/> |
| <EM><xsl:apply-templates select="TITLE"/>.</EM><BR/> |
| <xsl:apply-templates select="PUBLISHER"/></LI> |
| </xsl:template> |
| <xsl:template match="AUTHOR"> |
| <xsl:value-of select="@LAST"/>, |
| <xsl:value-of select="@FIRST"/> |
| </xsl:template> |
| <xsl:template match="TITLE"> |
| <xsl:value-of select="."/> |
| </xsl:template> |
| <xsl:template match="PUBLISHER"> |
| <xsl:value-of select="."/> |
| </xsl:template> |
| </xsl:stylesheet> |
| <!DOCTYPE stylesheet_umlaute [ |
| <!ENTITY Auml "Ä"> |
| <!ENTITY auml "ä"> |
| <!ENTITY Ouml "Ö"> |
| <!ENTITY ouml "ö"> |
| <!ENTITY Uuml "Ü"> |
| <!ENTITY uuml "ü"> |
| <!ENTITY szlig "ß"> |
| <!ENTITY nbsp " "> |
| ]> |
| <?xml version="1.0" ?> |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.0"> |
| <xsl:template match="/"> |
| <HTML> |
| <HEAD><TITLE>Books About XML</TITLE></HEAD> |
| <BODY> |
| <UL> |
| <xsl:apply-templates select="/BOOKLIST/BOOK"/> |
| </UL> |
| </BODY> |
| </HTML> |
| </xsl:template> |
| <xsl:template match="BOOK"> |
| <LI><xsl:apply-templates select="AUTHOR"/>:<BR/> |
| <EM><xsl:apply-templates select="TITLE"/>.</EM><BR/> |
| <xsl:apply-templates select="PUBLISHER"/></LI> |
| </xsl:template> |
| <xsl:template match="AUTHOR"> |
| <xsl:value-of select="@LAST"/>, |
| <xsl:value-of select="@FIRST"/> / |
| </xsl:template> |
| <xsl:template match="AUTHOR[end()]"> |
| <xsl:value-of select="@LAST"/>, |
| <xsl:value-of select="@FIRST"/> |
| </xsl:template> |
| <xsl:template match="TITLE"> |
| <xsl:value-of select="."/> |
| </xsl:template> |
| <xsl:template match="PUBLISHER"> |
| <xsl:value-of select="."/> |
| </xsl:template> |
| </xsl:stylesheet> |
| <?xml version="1.0" ?> |
| <?xml-stylesheet type="text/xsl" href="email_ie.xsl" ?> |
| <EMAIL> |
| <FROM>sbrass@sis.pitt.edu</FROM> |
| <TO>stefan.brass@informatik.uni-giessen.de</TO> |
| <CONTENTS>Die <EMPH>XSLT-Spezifikation</EMPH> |
| steht unter <URL>http://www.w3.org/TR/xslt</URL>. |
| </CONTENTS> |
| </EMAIL> |
| <xsl:template match="CONTENTS"> |
| <P><xsl:apply-templates/></P> |
| </xsl:template> |
| <xsl:template match="EMPH"><EM><xsl:apply-templates/></EM></xsl:template> |
| <xsl:template match="URL"><A |
| ><xsl:attribute name="HREF"/><xsl:value-of select="."/><xsl-attribute |
| ><xsl:apply-templates/></A></xsl:template> |
| <xsl:template match="text()"><EM><xsl:value-of select="."/></EM></xsl:template> |
Stefan Brass (sbrass@sis.pitt.edu), 24. August 2000
Original URL: http://www.informatik.uni-giessen.de/staff/brass/xml00/c7_xslt.xml