Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 7th, 2007, 07:04 PM
Authorized User
Join Date: Dec 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error "Failed to compile stylesheet"

I have an xsl that throws an error when doing

Transformer transformer = factory.newTransformer(myStreamSource);

Error is

Failed to compile stylesheet. 1 error detected.

I am using saxon 9 to parse and have included saxon9.jar to my classpath.

Style sheet is pasted below.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output indent="yes"/>
    <xsl:template match="/">

    <xsl:for-each select="table/tableMetaData/columns/dataColumn">


            <xsl:attribute name="width">
            <xsl:value-of select="width"/>

            <xsl:attribute name="type">edn</xsl:attribute>

            <xsl:attribute name="align">
            <xsl:value-of select="alignment"/>

            <xsl:attribute name="color">white</xsl:attribute>

            <xsl:attribute name="sort">str</xsl:attribute>

        <xsl:value-of select="name"/>


            <xsl:for-each-group select="table/tData/row" group-by="sData[1]/sValue">
                    <cell><xsl:value-of select="sData[1]/sValue"/></cell>
                    <xsl:for-each select="current-group()">
                            <xsl:call-template name="rowCtr"/>
                            <cell><xsl:value-of select="sData[2]/sValue"/></cell>
                            <xsl:apply-templates select="*[position() &gt; 1]"></xsl:apply-templates>
    <xsl:template match="table/tData/row/doubleDatum/values/value | table/tabelData/row/sData/sValue">
        <cell><xsl:value-of select="."/></cell>

    <xsl:template name="rowCtr" match="table">
        <xsl:attribute name="id">
            <xsl:number format="1" from="tData" count="row"/>


Reply With Quote
  #2 (permalink)  
Old December 7th, 2007, 07:20 PM
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

The first thing you need to do is to work out why you aren't seeing the error that Saxon is saying it has reported. Unless you did something special to redirect it, it will have been written to the standard error output. By default that goes to the console, but if you're in some kind of environment like an application server it probably goes to a log file somewhere. You can nominate your own ErrorListener to be notified of the errors, and then you can decide where to display them. There's not really much point trying to debug a stylesheet until you've got a development environment where you can see the error messages.

If I copy this to a file and run it from the command line the stylesheet compiles OK; so the problem is probably local to your environment. But there's no point speculating until you can find where that error message has been written.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile error: Syntax error: & Else without HELP Corey VB How-To 2 April 21st, 2006 03:25 PM
Firefox says "Error loading stylesheet: (null)" biolizard89 XSLT 2 July 7th, 2005 11:47 AM
Parsing an XSLT stylesheet failed .... :( Thebravehearth XML 0 October 12th, 2004 10:55 PM
Compile error johnkruse Access VBA 3 June 16th, 2004 05:06 PM
compile error burdickdave C# 1 October 20th, 2003 01:46 PM

All times are GMT -4. The time now is 12:28 PM.

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