RE: [xsl] trying to exclude result prefix

Subject: RE: [xsl] trying to exclude result prefix
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 23 Sep 2008 23:07:36 +0100
If you output a <mo> element in the XHTML namespace, then the XHTML
namespace will be declared, whether you like it or not. It seems you want
the <mo> element not to be in the XHTML namespace. You don't achieve that by
excluding the namespace declaration, you achieve it by creating the element
with the right name.

Which you can do using <mo xmlns="">...</mo>

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Fred Christian [mailto:fredc@xxxxxxxxxx] 
> Sent: 23 September 2008 18:35
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] trying to exclude result prefix
> 
> I am trying to exclude the namespace prefix from my output. 
> Also I admit to feeling over my head on the topic, a bit like 
> trying to figure out how to look up a word I don't know how 
> to spell in a dictionary. 
> 
> I am using Saxon 8.6.1 and have been using it for a few years 
> on this project with my 100's of kbytes of xslt code.
> 
> I did just tried Saxon 9 and got a "NullPointerException" on 
> my code. I don't need to solve that right now (At least I hope not).
> 
> I am not sure what other details are needed. Here are the 
> basics. I want to figure out how to change my xslt to get the 
> "Desired result xml" below.
> 
> My current result xml output snippet: 
> <mo xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> xmlns="http://www.w3.org/1999/xhtml";>TEST</mo><otherstuff/><mo
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> xmlns="http://www.w3.org/1999/xhtml";>END</mo> 
>  
> Desired result xml output snippet: 
> <mo>TEST</mo><otherstuff/><mo>END</mo> 
> 
> xslt code snippet: 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"  
> xmlns="http://www.w3.org/1999/xhtml"; 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";  
> xmlns:saxon="http://saxon.sf.net/"; 
> xmlns:kml="http://tempuri.org/BookDefinition.xsd"; 
> xmlns:m="http://www.w3.org/1998/Math/MathML"; 
> xmlns:ksp="http://www.w3.org/1999/xhtml"; 
> exclude-result-prefixes="kml xsl m" 
> extension-element-prefixes="saxon" 
> xmlns:alias="alias-namespace" 
>  >
> {lots of stuff}
> <xsl:template match="msup" mode="addonencode"> <mo 
> xsl:exclude-result-prefixes="#all"><xsl:text>
> </xsl:text></mo><xsl:copy>
> <xsl:apply-templates mode="addonencode"/></xsl:copy><mo
> xsl:exclude-result-prefixes="#all"><xsl:text> 
> </xsl:text></mo> </xsl:template> {lots of stuff} 
> 
> 
> By chance is there enough here to give me some hints?

Current Thread