Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 24th, 2006, 07:09 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XLS with XML containing JSP tags dom4j - weird!

Hi All,

Hope this is the right place to ask and somebody could help.

I've got an XML file which is similar to XHTML but also has jps tags ( c:if test="blah...") embedded. When I do my transformation I get:

org.dom4j.DocumentException: Error on line 439 of document:
The prefix "c" for element "c:if" is not bound. Nested exception: The prefix "c" for element "c:if" is not bound.
    at org.dom4j.io.SAXReader.read(SAXReader.java:482)
blah...

Below is a snippet from my method that does the conversion from a string into a Document object..

Code:
286  // Read file as a string
287  String fileAsString = FileUtils.readFileToString(mySourceFile,"utf-8");
288
289  // Convert to a Document object
290  Document srcDocument = DocumentHelper.parseText(fileAsString);

My source XML looks a little like this..
Code:
<div id="items">
    <c:if test="${not empty tariffs}">
        do something
    </c:if>
</div>
Anybody got any idea?

Many thanks,

Adam.
  #2 (permalink)  
Old May 24th, 2006, 07:49 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

My source XML looks a little like this..
Code:
<div id="items">
    <c:if test="${not empty tariffs}">
        do something
    </c:if>
</div>

Like the error message says, that's not namespace-well-formed XML because the "c:" prefix hasn't been declared.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #3 (permalink)  
Old May 24th, 2006, 08:32 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael,

Doh! That worked !

I put the following onto my root element and it worked:

xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tiles="http://java.sun.com/jsp/jstl/core"

Still a bit new to this.

Thanks for the quick reply.

Adam


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password protect XLS using XML aspless XML 6 April 30th, 2008 06:17 AM
ftl templates don't resolve jsp tags ridwanhabbal BOOK: Professional Java Development with the Spring Framework 0 June 26th, 2007 02:34 PM
browser version and JSP-custom tags neetukk JSP Basics 1 December 6th, 2006 03:29 AM
Weird Problem with XML Validation using SaxonB ravik@olemiss.edu XSLT 2 October 27th, 2005 02:26 PM
Renaming with XML tags? johrik XSLT 1 February 12th, 2004 03:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.