[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Namespaces in output

Subject: Namespaces in output
From: "Terry Ofner tdofner@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Sep 2021 13:43:36 -0000
 Namespaces in output
I am processing html exported from InDesign documents. As such, Every html
document comes with the standard doctype and namespace declarations:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

In the past, I have skirted the namespace tangle by manually removing the
doctype and replacing <html xmlns="http://www.w3.org/1999/xhtmlb> with an
element name that the Oxygen xslt engine would not quibble about, such as
<mybook>. Since I have too many documents to transform, I have left the
doctype and html/namespace in place and modified the stylesheet namespace
declarations like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="3.0"
    xmlns="http://www.w3.org/1999/xhtml"
    xpath-default-namespace="http://www.w3.org/1999/xhtml"
    xmlns:map="http://www.w3.org/2005/xpath-functions/map"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:saxon="http://saxon.sf.net/"
    exclude-result-prefixes="xs map #default saxon">


Well and good. I can address the html elements directly in my stylesheet.
However, the namespace http://www.w3.org/1999/xhtml appears in the root level
element of all output documents:

<div xmlns="http://www.w3.org/1999/xhtml" class="apE">
    <p class="subhead_ap_topic">2.2 Yada Yada</p>
    <p class="subhead_ap_h2">Yuda</p>
    <p class="body_first">NNNN</p>
    <p class="subhead_ap_h4">MMMM</p>
    <p class="body_text">PPPP</p>
</div>

When I remove the namespace at the root level using <xsl:element
name=bdivb namespace="">, the http://www.w3.org/1999/xhtml namespace
appears on all child elements:

<div class="apE">
    <p xmlns="http://www.w3.org/1999/xhtml" class="subhead_ap_topic">2.2 Yada
Yada</p>
    <p xmlns="http://www.w3.org/1999/xhtml" class="subhead_ap_h2">Yuda</p>
    <p xmlns="http://www.w3.org/1999/xhtml" class="body_first">NNNN</p>
    <p xmlns="http://www.w3.org/1999/xhtml" class="subhead_ap_h4">MMMM</p>
    <p xmlns="http://www.w3.org/1999/xhtml" class="body_text">PPPP</p>
</div>

My question: Is it possible to remove all namespaces from my result
documentsbshort of selecting * and rebuilding all elements using
<xsl:element namespace=bb>? These namespace declarations donbt hamper
the display of the resulting documents. However, text is text and the extra
load, over pages and pages of such output canbt but add time to rendering
pages. Of course, having one namespace declaration at the root level is
preferable to having all child elements carrying a ns.

Any help in this would be appreciated.

Terry

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.