Title: errors while loading and validating a XSL file

Hi,
I am using Xerces2 Java Parser 2.0.0 and try to load and validate a XSL file like this ...

  <?xml version="1.0" encoding="iso-8859-1"?>
  <xsl:stylesheet version="1.0"
                        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">               
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="@*|node()">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>

  </xsl:stylesheet>


with the following java method ...

  public void load(String filename) throws P2XMLException
  {
    DocumentBuilderFactory dbf;
    DocumentBuilder db;
    Document doc;
    Transformer transformer;
    StreamResult result;
   
    try {
      dbf = DocumentBuilderFactory.newInstance();
      dbf.setNamespaceAware(true);    
      dbf.setValidating(true);
               
      dbf.setAttribute("http://apache.org/xml/features/validation/schema",
                       new Boolean(true));
     
      db = dbf.newDocumentBuilder();
      db.setErrorHandler(new XMLDocument.XmlErrorHandler());
   
      System.out.println("load jaxp");
      doc = db.parse(filename);
     
      // ...
  }


and get errors like this

  Error at 3/66: cvc-elt.1: Cannot find the declaration of element 'xsl:stylesheet
  '.
  Error at 5/42: cvc-elt.1: Cannot find the declaration of element 'xsl:output'.
  Error at 7/35: cvc-elt.1: Cannot find the declaration of element 'xsl:template'.

  Error at 8/15: cvc-elt.1: Cannot find the declaration of element 'xsl:copy'.
  Error at 9/48: cvc-elt.1: Cannot find the declaration of element 'xsl:apply-temp
  lates'.
  Error at 13/35: cvc-elt.1: Cannot find the declaration of element 'xsl:template'
  .
  ...

thanks

Reply via email to