xsl-list
[Top] [All Lists]

AW: AW: Omitting default namespace in the output - XSLT 2.0

2004-12-21 00:34:14
Well acutally that would be quite a mess, but I think I've come to 
a practicable solution.
Thanks for your help.

wbr,
Roman

_______________________________________

Roman Huditsch
IT and Electronic Publishing
LexisNexis ARD Orac 
Marxergasse 25
1030 Vienna
Austria 
ph: +43-1-534 52-1514
f: +43-1-534 52-140
e-mail roman(_dot_)huditsch(_at_)lexisnexis(_dot_)at
www.lexisnexis.at
 

-----Ursprüngliche Nachricht-----
Von: António Mota [mailto:xptm(_at_)sapo(_dot_)pt] 
Gesendet: Montag, 20. Dezember 2004 18:30
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: AW: [xsl] Omitting default namespace in the 
output - XSLT 2.0

Write a empty template for the not wanted elements:

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

<xsl:template match="not-wanted">
<xsl:template>

Quoting Huditsch Roman <Roman(_dot_)Huditsch(_at_)lexisnexis(_dot_)at>:

Thanks for the quick reply, Michael.
I hoped that I wouldn't need to use generic templates, since that 
would in my case also mean many unwanted elements copied from my 
source tree.
But having clarified that <xsl:copy-of> won't help me here, I think 
that there is no other way...

Thank you very much!

wbr,
Roman

_______________________________________

Roman Huditsch
IT and Electronic Publishing
LexisNexis ARD Orac
Marxergasse 25
1030 Vienna
Austria
ph: +43-1-534 52-1514
f: +43-1-534 52-140
e-mail roman(_dot_)huditsch(_at_)lexisnexis(_dot_)at
www.lexisnexis.at


-----Ursprüngliche Nachricht-----
Von: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Gesendet: Montag, 20. Dezember 2004 15:20
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: RE: [xsl] Omitting default namespace in the 
output - XSLT 
2.0

If you copy elements using xsl:copy-of, the output elements will 
have the same names as the input elements, and the system will 
automatically add declarations of the namespaces used in these 
names. You want your output elements to have a different 
name from 
the input elements (same local name, different URI). So you can't 
use copy-of.

To copy a tree while renaming elements, use a modified 
form of the 
identity template rule:

<xsl:template match="*">
<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: Huditsch Roman 
[mailto:Roman(_dot_)Huditsch(_at_)lexisnexis(_dot_)at]
Sent: 20 December 2004 13:52
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Omitting default namespace in the output 
- XSLT 2.0

Hi,

Given an example input like:

<?xml version="1.0" encoding="UTF-8"?> <norm 
xmlns="myDefaultNamespace">
        <table>
                <row>
                        <cell>My Table</cell>
                </row>
        </table>
</norm>

I searched for an easy way to get output data, which is not
associated
to my default namespace any more, with the help of 
<xsl:copy-of> 
in XSLT 2.0 I hoped that the attribute 
"copy-namespaces" set to "no"
would help me here, but unfortunately I had no luck with Saxon 
8.1.1

My output still looks like

<table>
        <row xmlns="myDefaultNamespace">
                <cell>My Table</cell>
        </row>
</table>


XSLT:
=====

        <xsl:template match="ln:table">
                <table>
                        <xsl:copy-of select="node() | @*"
copy-namespaces="no"/>
                </table>
        </xsl:template>


Thanks in advance for your input!

wbr,
Roman
_______________________________________

Roman Huditsch
IT and Electronic Publishing
LexisNexis ARD Orac
Marxergasse 25
1030 Vienna
Austria
ph: +43-1-534 52-1514
f: +43-1-534 52-140
e-mail roman(_dot_)huditsch(_at_)lexisnexis(_dot_)at www.lexisnexis.at





--~------------------------------------------------------------------
XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--







O SAPO já está livre de vírus com a Panda Software, fique você também!
Clique em: http://antivirus.sapo.pt

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • AW: AW: Omitting default namespace in the output - XSLT 2.0, Huditsch Roman <=