File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Help Required in using If loop in XSL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Help Required in using If loop in XSL" Watch "Help Required in using If loop in XSL" New topic
Author

Help Required in using If loop in XSL

Ramesh R G V S
Greenhorn

Joined: Apr 20, 2002
Posts: 18
Hi
I am trying to use if loop in a xsl file.it is not wotking properly.here i am attaching the code of my xml file and xsl file.Can any one help in this regard.

XSL file
------------------

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">

<xsl:if test="price>10">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-----------------------
XML file
---------------
<?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited with XML Spy v4.2 --><?xml-stylesheet
type="text/xsl" href="cdshow1.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>12</price>
<year>1985</year>
</cd>
<cd>
<title>Ramesh</title>
<artist>XMT</artist>
<country>USA</country>
<company>Columbia</company>
<price>666</price>
<year>1985</year>
</cd>
</catalog>
----------------
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Ramesh,
The stylesheet elements needs revisiting:
1. You are referencing the XSLT working draft instead of the recommendation (you might be using a rather old version of XML Spy).
2. You miss the version attribute
If you replace your xsl:stylesheet element with the above, it should just work fine:

Cheers
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1164
Beno�t is right - the stylesheet works well after replacing the xsl:stylesheet element.
About the namespace - here is what Mapraputa said recently about it (http://www.coderanch.com/t/125023/XML/Keyword-xsl-sort-may-not)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
is an old, outdated namespace referring to Microsoft's early implementation of XSLT. It was in use before XSL specification was finished (note "WD" in the namespace - "Working Draft"). This version of XSLT is a little different from what we have now and there is no reason to use it! No other processor (other than MSXML) will work with your stylesheet. Standard namespace is
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Here is a table that keeps track of MSXML compliance with W3C spec:
http://www.vbxml.com/xsl/XSLTRef.asp


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
So far, I have done the XML transformation on the client side. I have a XSLT file to transform a XML file. I also have a HTML file which gives commands to load the XSLT and XML files and do the transformation. This transformation is done on the client side. And this is the limit of my knowledge.
To use a Java based XSLT processor, the xalan is recommended. I think that I have the xalan in my machine because I have JDK 1.4 in it.
Now, I have to do the transformation on the server side. I have the knowledge about Servlets; however, I have never used Servlets, XML, and XSLT together. I need guidance about doing the XML transformation on the server side. Please help.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Bellow, you will find the servlet implementation that could be used to performs the transform. Of course, it is only an example. In a real application this servlet should be generic enough to perform any transform on any XML file.

A ServletFilter object, as introduced by the Servlets 2.3 API could also be used to perform a XLST transform on XML resulting from a servlet.
Best luck
[ December 17, 2002: Message edited by: Beno�t d'Oncieu ]
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Thanks, Beno�t, for the code. I am going to try the code.
Ramesh R G V S
Greenhorn

Joined: Apr 20, 2002
Posts: 18
Hi Beno�t

thanx for the reply.I tried with the code you posted.But am getting the following error.
javax.xml.transform.TransformerConfigurationException: javax.xml.transform.Trans
formerConfigurationException: javax.xml.transform.TransformerException: org.xml.
sax.SAXParseException: The XML declaration may only appear at the very beginning
of the document.
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:691)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
---------
javax.xml.transform.TransformerConfigurationException: javax.xml.transform.Trans
formerException: org.xml.sax.SAXParseException: The XML declaration may only app
ear at the very beginning of the document.
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTemplates(T
ransformerFactoryImpl.java:863)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:676)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
---------
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The XML
declaration may only appear at the very beginning of the document.
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTemplates(T
ransformerFactoryImpl.java:859)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:676)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
---------
org.xml.sax.SAXParseException: The XML declaration may only appear at the very b
eginning of the document.
at weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java
:1090)
at weblogic.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLErr
or(XMLDocumentScanner.java:655)
at weblogic.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDo
cumentScanner.java:709)
at weblogic.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.
dispatch(XMLDocumentScanner.java:895)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocu
mentScanner.java:396)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:975)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:123)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:125)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTemplates(T
ransformerFactoryImpl.java:851)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:676)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
---------
org.xml.sax.SAXParseException: The XML declaration may only appear at the very b
eginning of the document.
at weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java
:1090)
at weblogic.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLErr
or(XMLDocumentScanner.java:655)
at weblogic.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDo
cumentScanner.java:709)
at weblogic.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.
dispatch(XMLDocumentScanner.java:895)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocu
mentScanner.java:396)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:975)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:123)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:125)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTemplates(T
ransformerFactoryImpl.java:851)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:676)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
---------
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The XML
declaration may only appear at the very beginning of the document.
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTemplates(T
ransformerFactoryImpl.java:859)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:676)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
---------
org.xml.sax.SAXParseException: The XML declaration may only appear at the very b
eginning of the document.
at weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java
:1090)
at weblogic.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLErr
or(XMLDocumentScanner.java:655)
at weblogic.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDo
cumentScanner.java:709)
at weblogic.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.
dispatch(XMLDocumentScanner.java:895)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocu
mentScanner.java:396)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:975)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:123)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:125)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTemplates(T
ransformerFactoryImpl.java:851)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:676)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
---------
org.xml.sax.SAXParseException: The XML declaration may only appear at the very b
eginning of the document.
at weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java
:1090)
at weblogic.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLErr
or(XMLDocumentScanner.java:655)
at weblogic.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDo
cumentScanner.java:709)
at weblogic.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.
dispatch(XMLDocumentScanner.java:895)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocu
mentScanner.java:396)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:975)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:123)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:125)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTemplates(T
ransformerFactoryImpl.java:851)
at weblogic.apache.xalan.processor.TransformerFactoryImpl.newTransformer
(TransformerFactoryImpl.java:676)
at weblogic.xml.jaxp.WebLogicSAXTransformerFactory.newTransformer(WebLog
icSAXTransformerFactory.java:204)
at weblogic.xml.jaxp.RegistrySAXTransformerFactory.newTransformer(Regist
rySAXTransformerFactory.java:216)
at XSLTServlet.doGet(XSLTServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

i have the all the following jars in my class path
c:\xmljars\jaxp.jar;
c:\xmljars\crimson.jar;
c:\xmljars\xalan.jar;
Do i need to set any thing else.
Regards
Ramesh R G V S
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Ramesh,
If you read carefully the error message, it says what your problem is :
The XML declaration may only appear at the very beginning of the document
This means that the following line (customise it with you own encoding) must appear at the first position at line 1:

Cheers
Ramesh R G V S
Greenhorn

Joined: Apr 20, 2002
Posts: 18
Hi
my XML contains that.Here i am giving my XML and XSL and the java program.
I am using weblogic6.1 and i kept my xml and xsl file
under C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp
and my class file under
C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\web-inf\classes.
Here are thr files.
------------------XML--------------
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
</catalog>
--------------XSL------------
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
<th>Price</th>
</tr>
<xsl:for-each select="catalog/cd">
<xsl:if test="number(price >= 10)">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
<td><xsl:value-of select="price"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
----------java--------------------
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.IOException;import java.io.InputStream;

public class XSLTServlet extends HttpServlet
{
protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws ServletException, IOException

{
super.doGet(httpServletRequest, httpServletResponse);
try
{
System.out.println("-----Inside do get of XSLTSrvlet");
// Get access to the servlet context to load needed resources
ServletContext ctx = getServletContext();
// Load the stylesheet
//String transformFilePath = "/myWebApp/res/xslt/cdshow1.xsl";
String transformFilePath = "cdshow1.xsl";

System.out.println("-----transformFilePath"+transformFilePath);
InputStream transformStream = ctx.getResourceAsStream(transformFilePath);

System.out.println("-----creating resourceStream for :"+transformFilePath);

Source transformSource = new StreamSource(transformStream);

System.out.println("-----creating stream source for : "+transformSource);

// Create the transformer object that will perform the XSLT transformation
TransformerFactory transformerFactory = TransformerFactory.newInstance();

System.out.println("-----Transformer factory"+transformerFactory);
Transformer transformer = transformerFactory.newTransformer(transformSource);

// Load the xml file
//String xmlFilename = "/myWebApp/res/data/cd-collection.xml";
String xmlFilename = "cd.xml";
InputStream xmlStream = ctx.getResourceAsStream(xmlFilename);
Source xmlSource = new StreamSource(xmlStream);
// Create a result object to produce its result in the response text
Result result = new StreamResult(httpServletResponse.getOutputStream());
// Perform the transformation
transformer.transform(xmlSource, result);
} catch (IOException e)
{
e.printStackTrace();
} catch (TransformerFactoryConfigurationError transformerFactoryConfigurationError)
{
transformerFactoryConfigurationError.printStackTrace();
} catch (TransformerException e)
{
e.printStackTrace();
}
}
}

Regards
Ramesh R G V S
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Xerces is complaining that the <?xml declaration is not in the top first position in one of your files.
So, make sure that there are no empty lines at the top of your XML or XSL file.
That's all I can see.
Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help Required in using If loop in XSL
 
Similar Threads
XSLT Problem
Unable to show data using XSL
Hyper links Using XSL?
Dynamic XML to HTML
Sample XML programs