Subject: Re: [xsl] xmlns:xi attributes getting into HTML output From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 26 Oct 2022 14:55:57 -0000 |
Firstly, I suspect that that "..." is hiding an identity template that uses xsl:copy. The xsl:copy instruction copies namespace nodes from the source document to the result document. In 2.0+ you can suppress that with a copy-namespaces="no" attribute. Secondly, why doesn't the HTML serialization method drop the namespace from the serialized output? I think that in later releases of XSLT it will do so, but I can't see anything in the XSLT 1.0 spec that says it should. Your stylesheet says version="2.0" but you're running it with a processor that only understands 1.0. Michael Kay Saxonica On 26 Oct 2022, at 15:45, Michael B Allen ioplex@xxxxxxxxx<mailto:ioplex@xxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx rytech.com>> wrote: Hello, Why is the xmlns:xi attribute ending up in my HTML and how do I exclude it? XML: <?xml version="1.0"?> ... <html xmlns:xi="http://www.w3.org/2001/XInclude"> ... <header> <a href="somepage.html" alt="SOMECOMPANY"> <img src="images/logoblue80.png" alt="SOMECOMPANY"/> <small>Some Small Text</small> </a> </header> XSLT: <?xml version="1.0"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" indent="no"/> ... <xsl:template match="header"> <header> <xsl:apply-templates select="@*|node()"/> </header> </xsl:template> HTML OUTPUT (see xmlns:xi in anchor element): <header><a xmlns:xi="http://www.w3.org/2001/XInclude" href="somepage.html" alt="SOMECOMPANY"> <img src="images/logoblue80.png" alt="SOMECOMPANY"> <small>Some Small Text</small> </a></header> The XSLT processor is PHP's XSLTProcessor::transformToXML. Mike -- Michael B Allen Java Active Directory Integration http://www.ioplex.com/ XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list> EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/293509> (by email<>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xmlns:xi attributes getting i, Michael B Allen iopl | Thread | Re: [xsl] xmlns:xi attributes getti, Michael B Allen iopl |
[xsl] xmlns:xi attributes getting i, Michael B Allen iopl | Date | Re: [xsl] xmlns:xi attributes getti, Michael B Allen iopl |
Month |