That will help only if this is an XSLT 2.0 stylesheet. In XSLT 1.0, it is not allowed. But considering running it under Saxon, I assume the Asker made his stylesheet in XSLT 2.0?
Main Topics
Browse All Topicshi there
i have a xsl stylesheet .. i use it to convert html to pdf using FOP... everytime i compile my program it says an error in my xsl stylesheet like
"[Fatal Error] 1.xsl:829:48: Element type "xsl:template" must be followed by either attribute specifications, ">" or "/>".
org.xml.sax.SAXParseExcept
at org.apache.xerces.parsers.
at org.apache.xerces.jaxp.Doc
at javax.xml.parsers.Document
at fop.Html2PdfFOP.getTransfo
at fop.Html2PdfFOP.fo2PDF(Htm
at fop.Html2PdfFOP.main(Html2
it says the error is the double quotes inside the " q|q[starts-with(.,' " ') " in my xsl stylesheet...
<xsl:template match="xhtml:q|q[starts-wi
when i try to remove the double quotes and compile it.. it gives the following error.. can anyone help me out....
(Location of error unknown)org.xml.sax.SAXExc
(Location of error unknown)org.xml.sax.SAXExc
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
hi there..
actually i took the stylesheet from the following link... i dont have any idea whether its XSLT 1 or 2... i need help guys...
http://webcoder.info/downl
hi gertone
i tried your solution.. but i ve got the following error.. i replaced your code with the older one in the xsl stylesheet..
(Location of error unknown)org.xml.sax.SAXExc
(Location of error unknown)org.xml.sax.SAXExc
java.lang.NullPointerExcep
at java.io.FileOutputStream.w
at fop.Html2PdfFOP.main(Html2
You need to add the namespace for xhtml to the top of your stylesheet:
xmlns:xhtml="http://www.w3
hi abel and gertone..
thanks for your replies... now i ve got another problem... no other errors except like
" C:\Users\gobicse\workspace
was coming.. say around 40 lines of same message again and again... and also there is no dummy.xsl file in the path which is shown above... the xsl file which i am using is in the desktop(which i named it as 1.xsl)...then why it is showing a file like this...
I see, the problem is that you took the stylesheet from the web using internet explorer
and you copied from the browser window.
You should download the raw xslt, not from the browser window but through "view source"
Internet Explorer generates all these "-" to collapse the nodes,
and they are in places not allowed in the stylesheet
you could do a general replace
"- <" into "<"
but you are better off, starting from the raw xslt
hi gertone
thanks for your reply.. i did the same way as you told me.. now i ve got the following error..
" java.net.MalformedURLExcep
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at org.apache.xerces.impl.XML
at org.apache.xerces.impl.XML
at org.apache.xerces.parsers.
at org.apache.xerces.parsers.
at org.apache.xerces.parsers.
at org.apache.xerces.parsers.
at org.apache.xerces.jaxp.Doc
at javax.xml.parsers.Document
at fop.Html2PdfFOP.getTransfo
at fop.Html2PdfFOP.fo2PDF(Htm
at fop.Html2PdfFOP.main(Html2
Perhaps it is a good idea to download a working source somewhere? this may go on for a long time before it's working, apparently this time someone put literal file references in the XSLT file, which is not allowed. They didn't give you a correct XSLT file, it seems. You can only use URI's when it comes to resources:
intead of c:\bla\bla.txt
you writer: file:///c:/bla/bla.txt
yes please, put the stylesheet here, so we can have a look.
Based on the questions so far, I am afraid that you don't have enough background to mess in a stylesheet as complex a this one.
I am afraid this is going to go on for ever.
Please advise your boss to get you some proper training or hire a consultant, if at some point you find out this is not going to work
hey,
1. If you are a student doing this, I recommend that you take the time to read through some XSLT tutorials
or a bunch of books. You can't shortcut time nor preparation
2. the XSLT you sent is exactly the one you pulled from the web reference above, that one I have.
You are experiencing difficulties with the changes you made. That is the one I would like to see.
Note that you need to run xml-tidy or something similar to guarantuee the wellformedness of your XHTML. DO you do that?
hi
i didnt use JTidy.. do i have to include that jar file in the java build path????.. well i am doing a web crawler project.. i almost finished my project... and i gave user a few options for saving the web page such as text,doc,pdf,html.... now everythin is working fine.. the problem is in the pdf file the images are not coming... so i thought using FOP to do this.. as i dont have much time left.. i have to do like this.. i have got only a weak to finish my project..... as i am working on the report now.. i dont have time to prepare for this.. tats y i need ur help...
hi gertone
i have posted the modified xsl stylesheet in the above post " 08/24/09 06:16 PM, ID: 25173934
" and also i mentioned the line number which i modified in the next post to that...
instead of these
<xsl:template match="xhtml:q|q[starts-wi
-
<fo:inline>
<xsl:call-template name="common-atts"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
-
i added
<xsl:template match="xhtml:q|q">
-<xsl:variable name="quot">"</xsl:vari
<xsl:if test="starts-with(., $quot)">
<fo:inline><xsl:call-template
<xsl:text disable-output-escaping="y
<xsl:apply-templates/>
<xsl:text disable-output-escaping="y
</fo:inline>
</xsl:if>
</xsl:template>
-
and i included xmlns:xhtml="http://www.w3
> i dont have time to prepare for this.. tats y i need ur help...
we are volunteers here, we usually give pointers, but don't do other people's work. If you're in a hurry, a forum is not a good place, instead consider professional services. My suggestion would be to take this one step back. You don't start building a city if you don't know how to build houses and roads. Of course, that's up to you...
apologies if this was not what you hoped to here...
Can you please post the XSLT as you have it now?
I don't believe copying your parts into the original XSLT will work , I did that before I posted, and it does not cause any errors,
there is something else going wrong
So I need your working copy of your stylesheet.
For instance the xhtml namespace is allready in the original stylesheet, so I don't understand why you need to add it.
Neither do I understand where other errors come from.... so please explain the process you are doing.
Is this homework or a study assignment?
> i already have the code.
perhaps I'm missing something here, but the original code was working, wasn't it? Can you make your changes one by one, using an XSLT editor (oXygen, Eclipse (free), Visual Studio (free)) so that you can fix errors while typing? After each edit, run the stylesheet. If problems are in the input, start out with something very simple, validate it on http://validator.w3.org and make sure to fix any errors that come up there.
Once the source is correcvt and you start out with the original stylesheet and add changes one by one, we can actually help you: a huge stylesheet like this one isn't easy for anybody, and requires careful editing and excellent knowledge of XML and XSLT related technologies.
ya its working... only exception which i get is
" java.net.MalformedURLExcep
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at org.apache.xerces.impl.XML
at org.apache.xerces.impl.XML
at org.apache.xerces.parsers.
at org.apache.xerces.parsers.
at org.apache.xerces.parsers.
at org.apache.xerces.parsers.
at org.apache.xerces.jaxp.Doc
at javax.xml.parsers.Document
at fop.Html2PdfFOP.getTransfo
at fop.Html2PdfFOP.fo2PDF(Htm
at fop.Html2PdfFOP.main(Html2
> ya its working... only exception which i get is
> " java.net.MalformedURLExcep
I told you already what's wrong there long time ago when you first came with that exception. Please refer back to http:#25183509 on how to solve this.
> the xslnm:xtml wat not in the original stylesheet... i included it...
Using your link that you posted above, I copied the first four lines of the stylesheet below. Are they in or are they in? ;-) I don't know how you copy it, but really, it is all in there...
I am under the impression that you didn't follow up on Gertone's comment to use the source, not the way it is rendered by FF, IE or whatever. Please download the source again to get a valid stylesheet to start with.
Please, we try to help, but that only works if you try to follow up our suggestions or explain why you don't or can't.
-- Abel --
correction my friend
this is what I found in the original stylesheet
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.o
xmlns:fo="http://www.w3.or
exclude-result-prefixes="x
the xhtml namespace declaration IS there
Gertone is correct, I just double checked and indeed, there are no external references in the XSLT, nor are there files locally referred to.
Probably, the method you use for instantiating needs an URI (like explained earlier) for source and input (and perhaps output too). Make sure you use URIs where they are expected, in your code.
It is generally not a good idea to combine steps when debugging.
Note that this started off as a pure XSLT question and now has become a pure Java question.
You can't debug all-in-on.
Isolate bits and check each bit in turn. Integrate after you are completely sure of the single bits
It took abel and me an awfull lot of time to get to a point that there is no longer an issue in the XSLT
Your a student, well learn from this comment please
A forum is generally a good place to get solutions, for isolated bits, not for full integrations
It is your task to isolate the problem
Here is how you should go about a project like this
- Develop the XSLT, preferably using an IDE, specially for a complex hump like this one,
- "Unit" test the XSLT, command line, using the exact same processor as you will use in the java code
- Run FOP on the resulting XSL-FO file, command line. This way, spot errors in your XSL-FO early
- Use the java code to create the XSL-FO, using the XSLT, leave the FOP bit out
- integrate the FOP process in the java, after all previous steps are succesfull
If you do it that way, you would be able to ask the right question, on the right forum
excellent structure, Gertone, I fully second that approach. New technologies don't always come easy and never come overnight. XSLT is no exception and to learn to understand, you best play with it a while. XSLT also requires XML, HTTP and, very important, XML Namespaces knowledge, . Making PDF requires also XSL-FO and (possibly) SVG knowledge. None of these are easy and each of them can take months to master. Do them a step at the time is probably the best advice we can give you here.
Business Accounts
Answer for Membership
by: GertonePosted on 2009-08-23 at 05:53:01ID: 25162425
make a variable able>
<xsl:variable name="quot">"</xsl:vari
and change the test like this
starts-with(.,$quot)