From chuck@cpjj.net Mon Feb 16 19:41:19 2009 Return-Path: X-Original-To: xslt@gnome.org Delivered-To: xslt@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by menubar.gnome.org (Postfix) with ESMTP id 428407500FC for ; Mon, 16 Feb 2009 19:41:19 +0000 (GMT) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.645 X-Spam-Level: X-Spam-Status: No, score=-1.645 tagged_above=-999 required=2 tests=[BAYES_00=-2.599, L_P0F_UNKN=0.8, TW_BX=0.077, TW_IB=0.077] X-Amavis-OS-Fingerprint: UNKNOWN [S4:53:1:60:M1460,N,N,N,N,N,N,N,N,N,N,N,N,N,N:Q0!:?:?], (link: ethernet/modem), [76.96.30.24] Received: from menubar.gnome.org ([127.0.0.1]) by localhost (menubar.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4dhuK8MZb8+5 for ; Mon, 16 Feb 2009 19:41:13 +0000 (GMT) Received: from QMTA02.emeryville.ca.mail.comcast.net (qmta02.emeryville.ca.mail.comcast.net [76.96.30.24]) by menubar.gnome.org (Postfix) with ESMTP id B17F07500EC for ; Mon, 16 Feb 2009 19:41:12 +0000 (GMT) Received: from OMTA13.emeryville.ca.mail.comcast.net ([76.96.30.52]) by QMTA02.emeryville.ca.mail.comcast.net with comcast id GjJt1b01f17UAYkA2jhCmm; Mon, 16 Feb 2009 19:41:12 +0000 Received: from [192.168.0.26] ([76.17.213.109]) by OMTA13.emeryville.ca.mail.comcast.net with comcast id GjhB1b0072NAvbg8ZjhBBw; Mon, 16 Feb 2009 19:41:12 +0000 From: Chuck Jungmann To: xslt@gnome.org Content-Type: text/plain Date: Mon, 16 Feb 2009 13:41:10 -0600 Message-Id: <1234813270.7696.200.camel@centaur> Mime-Version: 1.0 X-Mailer: Evolution 2.24.3 Content-Transfer-Encoding: 7bit Subject: [xslt] libxslt adding unwanted attributes X-BeenThere: xslt@gnome.org X-Mailman-Version: 2.1.10 Precedence: list Reply-To: The Gnome XSLT library mailing-list List-Id: The Gnome XSLT library mailing-list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2009 19:41:19 -0000 I'm new to these programs, having come from extensively using MSXML2 utilities in a Windows environment. So while experienced with XML and XSLT, I am pretty green with libxml2 and libxslt. What I'm attempting to do is manage a website by using XML tools to standardize web pages and to prepare a site map. In Windows, I used the DOM to open the XHTML files, check for and add CSS references and reconcile the internal links between pages in the website. I started by trying to do the same things with libxml2, but, unfortunately, libxml2 was frustrating me by either (in HTML mode) not properly closing the empty elements like and , or (in XML mode) closing the empty elements but adding redundant xmlns attributes to the element as well as redundant and elements. In one web page, I am using intra-page links to named elements. When I run the XHTML file through libxslt or xsltproc, those same elements have the name attribute and an extra id attribute with the same value. I wouldn't really care about this except that the next time I try to parse the file for updates, the parser chokes, in an unrecoverable way, on what it calls redundant attributes. I am using the Python bindings (libxml2.py, libxslt.py). I would be happy with a workaround. I tried to work with the result object of the transformation, which seems to be a somewhat crippled xmlDoc object. I tried to xpathEval() to find the broken tags, but xpathEval() returns no nodes. I can get to the node with result.children, but I can't get it with result.xpathEval("/html") I can reproduce the problem with the two simple files listed below. Note the last two templates in the xsl file are the special case for processing the element where the problem occurs. Run the example with the following command: xxx$ xsltproc --html demo.xsl demo.htm I would appreciate any advice. Thanks, Chuck Jungmann demo.xml: Demo libxslt Error

Demo libxslt Error

Here's a bogus link with href attribute that should be changed

Here's a named link that is improperly copied.

demo.xsl: