473,659 Members | 3,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:Date="jav a.util.Date"
xmlns:StringBuf fer="java.lang. StringBuffer"
xmlns:parser="e s.bfc.xslt.Pars er"
exclude-result-prefixes="Date StringBuffer parser">

<xsl:variable name="updateDat a" select="StringB uffer:new(' ')"/<!--
LINE 17 -->

<!-- Some code -->

<xsl:text disable-output-escaping="yes"> &lt;script
language="javas cript"&gt;</xsl:text>
function setSelectedSele ctionCriteriaFi elds(){
<xsl:value-of select="$update Data" 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.Illeg alArgumentExcep tion
file:///xsl/template/list.xsl; Line #327; Column #72;
java.lang.NullP ointerException

Why an empty string throws an IllegalArgument Exception? WHY?!! :(

Apr 12 '07 #1
3 2326
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:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:Date="jav a.util.Date"
xmlns:StringBuf fer="java.lang. StringBuffer"
xmlns:parser="e s.bfc.xslt.Pars er"
exclude-result-prefixes="Date StringBuffer parser">

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

<xsl:template match="/">
<script language="javas cript">
function setSelectedSele ctionCriteriaFi elds(){
<xsl:value-of select="$update Data" 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
1325
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: (Emplacement inconnu de l'erreur)Erreur XSLT
7
2141
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 just inputting a file and getting a file. Or giving a xerces dom and get a new xerces dom. I would like to know whether any of you tried with their own custom
0
1272
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 to upgrading Xalan and Xerces as our framework performs much XML transformation and processing. Does anyone have a link to known issues with such an upgrade (besides the Xalan / Xerces sites) ?
7
4118
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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" xmlns:my-javascript-ext="my-ext1" extension-element-prefixes="my-javascript-ext"
1
1743
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): javax.xml.transform.TransformerException:javax.xml.transform.TransformerException: xsl:document is not allowed in this position in the stylesheet! -------- The same transformation works fine with saxon ! What should I do ?
0
2144
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 is what the beginning of "ists_xslt3.xsl" looks like:
2
2295
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 select="encode-for-uri(/bla)"/> then I get a TransformerConfigurationException saying that there was an
6
4979
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 exceptions with large XML files. I tried a simple punt of -Xmx512MB but that didn't work. In the future, the input XML file may become considerably bigger than 96 MB, so even if it did work, it probably would be putting off the inevitable to some later...
2
1393
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 actually held in memory NOT as a disk file - for this we used xslt extension functions which work really well. So my question is, using xalan's tranform method, can I give it just a xslt file which then makes external calls to retrieve all the...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.