W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2002

DOM with XSL

From: NESTOR ZORZANO COZAR <nestorz@fedro.ugr.es>
Date: Thu, 25 Apr 2002 12:43:43 +0200 (MET DST)
To: www-dom@w3.org
Message-ID: <1019731423.3cc7dddf8189a@fedro.ugr.es>
Hello, we are students in University of Granada (Spain), we are doing the final
proyect of degree, and we need to use the DOM Interface. Specifically, we are
interested in create DOM Documents from scratch, which represent a stylesheet
(an archive .xsl). We are tried to do this, by this way:

             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
             DocumentBuilder db = dbf.newDocumentBuilder ();
             Document xslDoc = db.newDocument ();

             Element root = xslDoc.createElement ("xsl:stylesheet");
             Attr version=xslDoc.createAttribute("version");
             Attr xmlns=xslDoc.createAttribute("xmlns:xsl");

             xslDoc.appendChild (root);

             Element template=xslDoc.createElement ("xsl:template");
             Attr match=xslDoc.createAttribute("match");

             root.appendChild (template);

The Document is created, but when we try to transform a XML Document with it by 
we have problems. It cause a java.xml.transform.TransformerException : 
requires attribute version". Why?. Are we creating the DOM right?.

Also, we are tried to load a XSL Stylesheet empty from archive with this 

      <?xml version="1.0"?>
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

and full it with the content of our stylesheet, but it not transform neither. We 
put the
<xsl:template> tag as a child of <xsl:stylesheet> tag using the method 
applied on the Node loaded by xslDoc.getDocumentName(). When it is transformed 
it says
"xsl:template is not allowed in this position in the stylesheet!". Why?

What can we do?. Please help us!.
Received on Thursday, 25 April 2002 10:02:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:10 UTC