What is the difference between name() and local-name()?

Solution 1:

With the XML being

<x:html xmlns:x="http://www.w3.org/1999/xhtml"/>

the stylesheet

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">

  <xsl:output indent="yes"/>

  <xsl:template match="*">
    <local-name><xsl:value-of select="local-name()"/></local-name>
    <name><xsl:value-of select="name()"/></name>
  </xsl:template>

</xsl:stylesheet>

outputs

<local-name>html</local-name>
<name>x:html</name>

So the local-name() result is without any prefix, the name() result might include a prefix.

In your sample with a default namespace declaration no prefix is present, therefore name() and local-name() give the same result.