473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Using Xalan for XSL Transformation

Hello, I have to use xalan to transform some XML using XSL, but I have
some problems
within the XSLs, and Xalan doesn't give very good error messages. Is
there any
way to put Xalan on debug or trace mode or something else?, it's
almost impossible to find the
problems with those messages. i.e.:

This is /xsl/template/list.xsl

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:Date="java.util.Date"
xmlns:StringBuffer="java.lang.StringBuffer"
xmlns:parser="es.bfc.xslt.Parser"
exclude-result-prefixes="Date StringBuffer parser">

<xsl:variable name="updateData" select="StringBuffer:new(' ')"/<!--
LINE 17 -->

<!-- Some code -->

<xsl:text disable-output-escaping="yes">&lt;script
language="javascript"&gt;</xsl:text>
function setSelectedSelectionCriteriaFields(){
<xsl:value-of select="$updateData" disable-output-escaping="yes" /
<!-- LINE 327 -->
}
<xsl:text disable-output-escaping="yes">&lt;/script&gt;</xsl:text>

</xsl:stylesheet>

This is the error:
file:///xsl/template/list.xsl; Line #17; Column #66;
java.lang.IllegalArgumentException
file:///xsl/template/list.xsl; Line #327; Column #72;
java.lang.NullPointerException

Why an empty string throws an IllegalArgumentException? WHY?!! :(

Apr 12 '07 #1
3 2295
I forgot to mention that I'm using the last Xalan version, and JDK5.

Apr 12 '07 #2
It's extremely hard for a processor to give good error messages for
errors in the use of extension functions, and that's what you seem to
have here.

When I have time I'll try to look at this in more detail... but mucking
about with a StringBuffer is almost certainly the wrong solution.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 12 '07 #3
After fixing some of the typos and omissions and blatent bad practices
in the fragment you showed us (other than the use of extension code
where it's probably not necessary and in a way that implies you're
forgetting that XSLT doesn't guarantee execution order), it runs without
errors in a reasonably recent version of Xalan executed under Java
1.4.1. In fact, modifying the StringBuffer's initialization, I can
confirm that it's being passed through and retrieved from successfully.

Rebuilt all of Xerces and Xalan under Java 1.5, and ran the stylesheet
under that... and it worked fine there too.

No Trouble Found in Xalan. If you want help, you're going to have to
give us enough information to let us replicate and diagnose the problem.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:Date="java.util.Date"
xmlns:StringBuffer="java.lang.StringBuffer"
xmlns:parser="es.bfc.xslt.Parser"
exclude-result-prefixes="Date StringBuffer parser">

<!-- Stateful extension functions are a BAD PRACTICE! -->
<xsl:variable name="updateData" select="StringBuffer:new(' ')"/>

<xsl:template match="/">
<script language="javascript">
function setSelectedSelectionCriteriaFields(){
<xsl:value-of select="$updateData" disable-output-escaping="yes" />
}
</script>
</xsl:template>

</xsl:stylesheet>


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bastien | last post by:
Hi all I get an xml file which refer to a xsl file . this xsl refer to others xsl files. I use xalan to do the transformation xml+xsl=>html but we I launch xalan *I get an error: ...
7
by: Ganesh Gella | last post by:
Hi All, I am planning to use Xalan to transform XML data by applying xls stylesheets. Here tricky part is, Xalan provides several C++ APIs, which are very much useful if our requirement is...
0
by: cvissy | last post by:
I've been tasked with upgrading the JVM from 1.3 to 1.4, and the third party libraries used by my company on our existing Java framework. I'm most worried about any problems that may occur due...
7
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet...
1
by: Papastefanos Serafeim | last post by:
I want to use the <xsl:document> XSLT command with xalan, but I get the following error message -------- XSLT Error (javax.xml.transform.TransformerConfigurationException):...
0
by: atlantis | last post by:
Hi, I have a very strange problem with xsl:import when usig RELATIVE path on AIX 5.2 server. I have two XSL files in the same directory: "ists_xslt3.xsl" and "ists_xslt3_layout.xsl". This...
2
by: Felix Engelhardt | last post by:
Hi there, I'm having a problem compiling an XSL-stylesheet using JAXP/Xalan which is really driving me nuts... When I try to compile a stylesheet that contains something like: <xsl:value-of...
6
by: Lenny Wintfeld | last post by:
Hi I'm attempting additions/changes to a Java program that (among other things) uses XSLT to transform a large (96 Mb) XML file. It runs fine on small XML files but generates OutOfMemory...
2
by: harryajh | last post by:
using xalan 2.7.1 within Java 5.0 I want to produce a stylesheet from another stylesheet but there is NO xml. Also the stylesheet produced is actually made up of 10 sections of xslt which is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.