From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Sent Newsgroups: gmane.lisp.guile.user Subject: Removing/Ignoring xmlns when using xml->sxml Date: Sun, 21 Jul 2024 23:11:50 -0400 Message-ID: <875xsy3ytl.fsf@freakingpenguin.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40085"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Jul 22 05:17:49 2024 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sVjYa-000AJc-Oj for guile-user@m.gmane-mx.org; Mon, 22 Jul 2024 05:17:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVjY8-0002il-IJ; Sun, 21 Jul 2024 23:17:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVjY7-0002ib-E0 for guile-user@gnu.org; Sun, 21 Jul 2024 23:17:19 -0400 Original-Received: from mail-108-mta70.mxroute.com ([136.175.108.70]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sVjXw-0001Ln-A7 for guile-user@gnu.org; Sun, 21 Jul 2024 23:17:10 -0400 Original-Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta70.mxroute.com (ZoneMTA) with ESMTPSA id 190d86caac700017a3.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 22 Jul 2024 03:11:58 +0000 X-Zone-Loop: bb6d05123c9e26d7121ad590d75e11bbcf1b4fed622f X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=drgvHv/RI4bPTDG56XGXInomNh2QITdSzThCT6lzlCM=; b=lmkCI0UTd3FgFiRKt+KSAxVFW+ jH1ysQX3EHISwjIVPMzhdqkFqknt/DJwgLg3ok3ggKn4OW6yQ7Bo+cE+E2TFbQC/+ihaEqvvwi0+5 YE6JVBkvajQI8zlPr4DR6ghYNW/xz7zsSlWZLpdFf7I5gdj/bgpkXrecrKhHNelIBJU1ceSaKTHEn X14atw0LS//yC4bGQuMmR6xZyB53wji6pBj5b6jYUp3JB9ePwp7kcsVkii7Vd1WmSXJH2G8vkYVX8 N05M8BUdRajdlmD6HECCRUYvvTSlWXlfmflQ8yfZEQS0mChZla0v0y1wzjJLqbIo3Dlj9ajgr+aBn fcck+bmw==; X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.70; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta70.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19747 Archived-At: Hi all, I have some XML created by a tool called latexml that can convert LaTeX equations to MathML. I am processing the output of this tool as part of a Guile program and will be using it in a website. The output looks something like this: --8<---------------cut here---------------start------------->8--- 1 2 --8<---------------cut here---------------end--------------->8--- I need to convert this output to SXML to integrate it with the rest of the toolchain. Annoyingly, when using xml->sxml, the xmlns attribute is prepended to every non-default element. For example, '(http://www.w3.org/1998/Math/MathML:math ...) [1]. This behavior is undesirable when splicing the MathML into HTML, since HTML doesn't support namespaces and web browsers don't seem to handle elements with colons. The intended conversion is to simply splice the MathML into HTML, sans namespace [2]. xml->sxml has a #:namespaces argument that allows me to alias the URL namespace to something else in the SXML, but it doesn't look like I can alias it to a "nil" namespace that isn't prepended at all. The only option I can think of is to strip the xmlns=blah string from the XML ahead of time. (Because converting to SXML prepends every element, that's a lot harder to fix.) This solution feels rather hacky. Does anyone know of a better way? I don't believe latexml has an option to force HTML-compatible MathML output for individual equations. I'd be surprised if no one else encountered this before. Hopefully I'm missing something. Thanks! :) [1]: (guile) Reading and Writing XML, "SXML elements built from non-default namespaces will have their tags prefixed with their URI." [2]: https://en.wikipedia.org/wiki/MathML#Embedding_MathML_in_HTML/XHTML_files -- Take it easy, Richard Sent Making my computer weirder one commit at a time.