Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old December 7th, 2007, 07:04 PM
Authorized User
 
Join Date: Dec 2007
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="/">
        <rows>


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



        <column>

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

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

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

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

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

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


    </xsl:for-each>
    </head>

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

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

</xsl:stylesheet>





 
Old December 7th, 2007, 07:20 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





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





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