Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] copy-of namespace problem

From: "Michael Kay" <mike@------------>
To:
Date: 4/1/2005 9:27:00 AM
The important thing to remember about copy-namespaces="no" (as with
exclude-result-prefixes) is that it only suppresses the copying of a
namespace node that is unused. It doesn't cause the element you are copying
to be moved into a different namespace (or into no namespace). In your
example, as far as I can see, the only namespace that's in scope for
uc:tgroup is the uc namespace itself (and of course the xml namespace), and
although the uc namespace isn't copied, it will be regenerated in the result
tree as part of the namespace fixup process, because the result tree will
always contain namespace nodes for all namespaces that are used in element
and attribute names.

If you want to change the name of the uc:tgroup element and its children so
that they are in no namespace, you need to use a modified form of the
identity template:

<xsl:template match="uc:*">
  <xsl:element name="{local-name()}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

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


> -----Original Message-----
> From: Klocker Christoph [mailto:Christoph.Klocker@xxxxxxxxxxxxx] 
> Sent: 01 April 2005 09:56
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] copy-of namespace problem
> 
> Hi,
> I am copying some elements, and want to exclude the namespace, but the
> copy-namespaces="no" seems not to work. Using Saxon-8.2
> 
> My stylesheet
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:html="http://www.w3.org/HTML/1998/html4"
> exclude-result-prefixes="html xs uc" 
> extension-element-prefixes="xlink"
> xmlns:uc="http://www.infinity-loop.de/upcast/generic-dtd-v30">
> 	<xsl:output method="xml" version="1.0" encoding="UTF-8"
> indent="yes"/>
> 	<xsl:template match="//uc:table">
> 		<calstable>
> 			<xsl:copy-of select="uc:tgroup"
> copy-namespaces="no"/>
> 		</calstable>
> 	</xsl:template>
> </xsl:stylesheet>
> 
> My xml file
> <?xml version="1.0" encoding="UTF-8"?>
> <publication publ-day="20" publ-month="5" publ-year="2003" 
> issue="5404">
> 	<file id="5404/17/2003" doctyp="5404">
> 		<uc:part
> xmlns:uc="http://www.infinity-loop.de/upcast/generic-dtd-v30">
> 			<uc:table frame="none" colsep="0" rowsep="0">
> 				<uc:tgroup cols="3" colsep="0"
> rowsep="0">
> 					<uc:colspec colnum="1"
> colname="col1" colwidth="245"/>
> 					<uc:colspec colnum="2"
> colname="col2" colwidth="132"/>
> 					<uc:colspec colnum="3"
> colname="col3" colwidth="141"/>
> 					<uc:tbody>
> 						<uc:row>
> 							<uc:entry
> valign="top">
> 								<uc:par
> kind="Text standard" halign="justified">Durchschnitt 2000 = 
> 100</uc:par>
> 							</uc:entry>
> 							<uc:entry
> valign="top">
> 								<uc:par
> kind="Text standard" halign="justified">105,7</uc:par>
> 							</uc:entry>
> 							<uc:entry
> valign="top">
> 								<uc:par
> kind="Text standard" halign="justified">
> 	
> <uc:inline kind="bold">+1,3%</uc:inline>
> 	
> </uc:par>
> 							</uc:entry>
> 						</uc:row>
> 					</uc:tbody>
> 				</uc:tgroup>
> 			</uc:table>
> 		</uc:part>
> 	</file>
> </publication>
> 
> thanks
> christoph


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent