Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Using Xalan for XSL Transformation

Reply
Thread Tools

Using Xalan for XSL Transformation

 
 
=?iso-8859-1?q?Eduardo_Y=E1=F1ez_Parareda?=
Guest
Posts: n/a
 
      04-12-2007
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"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlnsate="java.util.Date"
xmlns:StringBuffer="java.lang.StringBuffer"
xmlnsarser="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?!!

 
Reply With Quote
 
 
 
 
=?iso-8859-1?q?Eduardo_Y=E1=F1ez_Parareda?=
Guest
Posts: n/a
 
      04-12-2007
I forgot to mention that I'm using the last Xalan version, and JDK5.

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      04-12-2007
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
 
Reply With Quote
 
Joe Kesselman
Guest
Posts: n/a
 
      04-13-2007
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"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlnsate="java.util.Date"
xmlns:StringBuffer="java.lang.StringBuffer"
xmlnsarser="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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with <xsl:document> using xalan (jdk 1.5) Petterson Mikael XML 3 05-23-2007 04:53 PM
Use output of XSL transformation as new XSL stylesheet barney.b@iname.com XML 0 01-16-2006 02:29 PM
Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2 cvissy XML 0 11-16-2004 07:06 AM
How can I evaluate a XSLT param/variable during a Xalan C++ transformation ? philips XML 2 07-17-2004 08:28 PM
XSL+XML=> HTML using xalan. bastien XML 0 05-25-2004 08:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57