Michael,
thank you so much for helping me understand this. Many thanks

regards

Andrew

On 21/07/06, Michael Kay < mike@saxonica.com> wrote:
Suppose your source element is
 
<p:q xmlns:p="http://p.uri/"/>
 
If you do
 
<xsl:element name="{local-name()}"/>
 
then the output will be
 
<q/>
 
(this technique is recommended when you want to get rid of the namespace).
 
If you do
 
<xsl:element name="{local-name()}" namespace="{namespace-uri()}"/>
 
the output will be
 
<ns0:q xmlns:ns0="http://p.uri/"/>
 
where ns0 is some arbitrary prefix. In theory, the choice of prefix doesn't matter.
 
If you do
 
<xsl:element name="{name()}" namespace="{namespace-uri()}"/>
 
the output will be
 
<p:q xmlns:p="http://p.uri/"/>
 
You could also achieve this using <xsl:copy/>.


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Andrew
Sent: 20 July 2006 23:19
To: Mailing list for SAXON XSLT queries
Subject: Re: [saxon] Transform problem

Hi Michael,
please forgive my XSL naivity but I tried a combination of fi:local-name() and <...name="{local-name()}" namespace="{namespace}" /> but to no avail. Could you please expand on what you mean please?

<?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
        xmlns:xsl=" http://www.w3.org/1999/XSL/Transform "
        xmlns:cinclude="http://apache.org/cocoon/include/1.0"
        exclude-result-prefixes=
"cinclude">
        <xsl:template match="/">
          <html>
                <head>
                </head>
               
            <body>
              <table width="261" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><xsl:apply-templates select="//login_fields"/></td>
                  </tr>
                </table>
</body>
</html>
</xsl:template>

<xsl:template match="login_fields">
    <xsl:apply-templates/>
</xsl:template>

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

<xsl:template match="@*|text()">
      <xsl:copy/>
</xsl:template>
</xsl:stylesheet>

regards

Andrew

> And yes, I am using <xsl:element
> name="{local-name()}">,

Then that's the reason. If you only copy the local name and not the
namespace, then you shouldn't be surprised that the resulting element has
the same local name but a different namespace.

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


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net 's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
saxon-help mailing list
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
saxon-help mailing list
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help