This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Newbie: javax . xml . transform . Transformer Configuration Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Newbie: javax . xml . transform . Transformer Configuration Exception" Watch "Newbie: javax . xml . transform . Transformer Configuration Exception" New topic
Author

Newbie: javax . xml . transform . Transformer Configuration Exception

Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
I am trying to test an example of the ujac print utility using an xsl file that comes bundled with majix.

http://ujac.sourceforge.net/html/print.html
http://sourceforge.net/projects/majix/

When I call this line of code


It throws the exception


Here are the first few lines of the xsl file.


Now I can see the line the exception is referring to, but I am not very familiar with xsl. Could anyone explain what this error means and what might be my next steps in fixing it? A nudge in the right direction would be a great help.

TIA
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Does the error message really refer to "xsl:space"? The element you displayed doesn't contain that attribute, it contains "xml:space".
Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
Originally posted by Paul Clapham:
Does the error message really refer to "xsl:space"? The element you displayed doesn't contain that attribute, it contains "xml:space".


Yes, you are right. I posted the wrong section of xml. Here is an example

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

There isn't any xsl:space attribute in XSLT, at least not in XSLT 1.0, which I assume is what you are using. There is xsl:strip-space and xsl:preserve-space but those are elements, not attributes.

Whoever wrote that appears to have confused those things with the xml:space attribute. Normally whitespace-only text nodes in a template are ignored by the XSLT processor, but the xml:space attribute can override that behaviour. In your example, xml:space="preserve" would mean that the processor should preserve the line-ending character after the <TABLE> tag (i.e. write it into the output document) and the line-ending character before the </TABLE> tag.

Which seems unnecessary to me, but that's another question.
Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
Yes, I am using XSLT 1.0. Thanks, that makes sense. I really appreciate the explanation. I did not know where to start with that one and the w3.org xslt docs are still reading like greek to me at this point.

One error fixed another one to go! But at least google returned results on this one. Off to read about this error, xml:space="preserve", xsl:strip-space and xsl:preserve-space.

Thanks again.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Originally posted by Corrie L Sherone:
... the w3.org xslt docs are still reading like greek to me at this point...
Not the best way to learn XSLT. You could look for XSLT tutorials on the Internet but unfortunately most of the things I found that claim to be "tutorials" just rehash what the elements do and fail to explain things like the built-in template rules. If you're going to be doing anything significant with XSLT you should consider getting a book.
Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
Originally posted by Paul Clapham:
most of the things I found that claim to be "tutorials" just rehash what the elements do and fail to explain things like the built-in template rules.


Yes, that jives with my experiences as well. If you have any recommendations on books you have found helpful, or even ones to avoid, let me know. I will keep it mind.

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

The book I learned XSLT from is by Michael Kay. My edition is copyright 2000 so I expect there are a couple of more recent versions. Michael Kay probably knows more about XSLT than anybody else on the planet and his book was quite readable. It did have to rehash what all the elements do, of course, but it had good examples and explanations.

I expect modern XSLT books would cover XSLT 2.0, which most people aren't using yet. His certainly would, since he's the author of the thing. Make sure that any book you buy clearly identifies what elements are 2.0 only.
Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
Thanks for the good recommendation. I found an old article that gives a hint of his writing style. So I will probably decide to go with one of his books.

http://www.ibm.com/developerworks/library/x-xslt/

Cheers
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Newbie: javax . xml . transform . Transformer Configuration Exception
 
Similar Threads
Issues deploying Java application
JDK bug?
A Beginner's Question
getAssociatedStylesheets failed
XSLT OUTPUT