سؤال

I have an XML document on eXist-db but the compiler is complaining giving me the following error:

Cannot compile xquery: exerr:ERROR org.exist.xquery.XPathException: err:XPST0003 unexpected token: xml-stylesheet href="../xsltforms/xsltforms.xsl" type="text/xsl" [at line 2, column 1]

I have tried everything I could think of:

  • copying the xml on to an xhtml document.
  • removing the tags that it's complaining about ( but it then goes to complain about other tags)
  • run the xml in eXist with no result
  • run the html generated by it in the browser with another error too.

This is the relevant part of the XML I think:

nuevacontribucion.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="../xsltforms/xsltforms.xsl" type="text/xsl" ?><?css-conversion no?><?xsltforms-options debug="no"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xf="http://www.w3.org/2002/xforms">
<head>
    <title>Crear una nueva Contribución</title>
    <link href="../css/loading.css" rel="stylesheet"/>
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"/>
    <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen"/>
    <link href="assets/styles.css" rel="stylesheet" media="screen"/>
        <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="vendors/flot/excanvas.min.js"></script><![endif]-->
        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    <script src="vendors/modernizr-2.6.2-respond-1.1.0.min.js"/>
    <style>
        input[type='text'], select{
            min-height: 30px;
        }
        iframe{
            width: 100% !important;
            height: 200px !important;
        }
        .datepicker .aid-button{
            display: none !important;
        }
    </style>

If I remove the xml-stylesheet tag then it throws the same exception but complaining about css-conversion, if I remove it then it's about the following tag, if I remove it then it's about xmlns not being defined or something.

هل كانت مفيدة؟

المحلول

Change the XSLT engine from Saxon to Xalan.

By default, eXist-db 2.0 comes with the following configuration in conf.xml in the eXist-db install directory:

 <transformer class="net.sf.saxon.TransformerFactoryImpl">

To solve your problem, change it to:

<transformer class="org.apache.xalan.processor.TransformerFactoryImpl">
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top