Subject: RE: [xsl] Excluding one particular attribute(namespace) when copying elements From: "Michael Kay" <mhk@xxxxxxxxx> Date: Fri, 31 Oct 2003 23:00:46 -0000 |
> > I need to copy different element to output. For all > the elements I need to exclude the namespace attribute > when i use "xsl:copy-of" or "xsl:copy". It seems > difficult to specify this in XSLT. Any comment would > be appreciated! > Firstly you need to understand that namespaces are not attributes in the XSLT data model. Namespace declarations in the serialized output are produced as representations of the namespace nodes in the result tree. Secondly, copy does a copy, not a "copy everything except X". You get more control with xsl:copy than with xsl:copy-of, but copying an element node still copies its name unchanged and its namespace nodes unchanged. Thirdly, you don't say you want to drop a namespace that is actually used, or whether you want to drop it because it is unused. The two situations are very different. If you want to drop an unused namespace, you can do it by using <xsl:element name="local-name()" namespace="namespace-uri()"> in place of <xsl:copy>. If you want to drop a namespace that is in use, then what you are really doing is changing the name of the element (or its attributes). But again, you can do this by using <xsl:element>, this time changing the value of the namespace attribute to select the namespace that you want the new element to be in. If you get the names of the elements and attributes right, the namespace declarations in the output will usually look after themselves. Michael Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Excluding one particular , M. David Peterson | Thread | [xsl] What is the difference ?, Emilio Gustavo Ormeñ |
RE: [xsl] A grouping question ?, Américo Albuquerque | Date | RE: [xsl] Or with xsl:when to check, Michael Kay |
Month |