You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Aditya Shevchenko Siregar <ke...@eudoramail.com> on 2002/08/04 15:01:41 UTC
need help on xslt
Hello. My name is Aditya. I'm from Indonesia. I am a student of Gadjah Mada University, Faculty of Electrical engineering. I have just download Xalan Java 2 for converting my xml document into html using xslt. I am a beginner, so I would like to ask if anyone can solve my problem.
I test a convertion from the xml listing I downloaded like this :
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="test.xsl" output="html"?>
<book>
<!-- Title of the book -->
<title>Professional Php Programming (Programmer to Programmer)</title>
<!-- Authors of the book -->
<text>This book has been authored by:</text>
<authors>
<author number="1">Sascha Schumann</author>
<author number="2">Harish Rawat</author>
<author number="3">Jesus M. Castagnetto</author>
<author number="4">Deepak T. Veliath</author>
</authors>
<!-- Image of the book -->
<text>A picture of the book's cover: </text>
<picture>http://images.amazon.com/images/P/1861002963.01.MZZZZZZZ.jpg</picture>
<!-- Pricing info-->
<text>The pricing of the book is as follows:</text>
<prices>
<price>List price: $49.99</price>
<price>Our price: $39.99</price>
<price>You save: $10.00</price>
</prices>
<!-- Other misc info-->
<text>Here is some sundry info about the book:</text>
<bookinfo>
<type>Paperback</type>
<amazonrank>6,337</amazonrank>
<pages>909</pages>
<publisher>Wrox Press</publisher>
<isbn>1861002963</isbn>
<size>2.00 x 9.16 x 7.30</size>
<url>http://www.amazon.com/exec/obidos/ASIN/1861002963/o/qid=986194881/sr=8-1/ref=aps_sr_b_1_1/107-4263716-8514955</url>
</bookinfo>
</book>
and my xsl file is like this :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:template match="/">
<html><body>
<xsl:apply-templates/>
</body></html>
</xsl:template>
<!-- This is the title of the page -->
<xsl:template match="title">
<b><u>
<xsl:value-of select="."/>
</u></b>
</xsl:template>
<xsl:template match="text">
<p/><b>
<xsl:value-of select="."/>
</b><br/>
</xsl:template>
<xsl:template match="authors">
<table>
<xsl:apply-templates/>
</table><br/>
</xsl:template>
<xsl:template match="author">
<tr>
<td>
<xsl:value-of select="@number"/>.
</td>
<td>
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<xsl:template match="prices">
<p/> <table>
<xsl:apply-templates/>
</table><p/>
</xsl:template>
<xsl:template match="price">
<tr>
<td>
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<xsl:template match="bookinfo">
<p/>
<xsl:apply-templates/>
<p/>
</xsl:template>
<xsl:template match="bookinfo/*">
<xsl:choose>
<xsl:when test="local-name(.)='type'">
<b>Type:</b>
</xsl:when>
<xsl:when test="local-name(.)='amazonrank'">
<b>Amazon rank:</b>
</xsl:when>
<xsl:when test="local-name(.)='pages'">
<b>Number of pages:</b>
</xsl:when>
<xsl:when test="local-name(.)='publisher'">
<b>Publisher:</b>
</xsl:when>
<xsl:when test="local-name(.)='isbn'">
<b>ISBN #:</b>
</xsl:when>
<xsl:when test="local-name(.)='size'">
<b>Dimensions in inches:</b>
</xsl:when>
<xsl:when test="local-name(.)='url'">
<b>More info from this link:</b>
</xsl:when>
</xsl:choose>
<xsl:value-of select="."/>
<br/>
</xsl:template>
</xsl:stylesheet>
The trouble is, when I try to convert to HTML using the standard command line instruction from DOS Prompt, there is an error like this :
(Location of error unknown)XSLT Error (javax.xml.transform.TransformerConfigurationException):javax.xml.parsers.FactoryConfigurationError:Provider for javax.xml.parsers.SAXParserFactory cannot be found.
I have set the classpath including the files needed in the readme file of the distribution (xerceslmpl.jar, xml-apis.jar, and xalan.jar).
Can anyone solve this? Please help and thank you before.
PS: I use Windows98 and JDK 1.1.8
---
=========Five dozens roses of love========
=====Keep the spirit of love flourish=====
Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com