You put a namespace declaration in XSLT, for example:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" exclude-result-prefixes="atom" > <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE"> <xsl:apply-tepmplates select="atom:feed/atom:entry" /> </body> </html> </xsl:template> <xsl:template match="atom:entry"> <div style="background-color:teal;color:white;padding:4px"> <span style="font-weight:bold"> <xsl:value-of select="atom:title"/> </span> <xsl:text> - </xsl:text> <xsl:value-of select="atom:author"/> </div> <div style="margin-left:20px;margin-bottom:1em;font-size:10pt"> <b><xsl:value-of select="atom:published" /> </b> <xsl:value-of select="atom:summary" disable-output-escaping="yes" /> </div> </xsl:template> </xsl:stylesheet>
Note that the ATOM namespace is registered with the atom: prefix and is used in all XPath throughout the stylesheet. I used exclude-result-prefixes to make sure atom: will not appear in the resulting document.
Also note that I replaced your <xsl:for-each> with a template. You should try to avoid this - each in favor of patterns.
Using disable-output-escaping="yes" somewhat dangerous when combined with XHTML - unless you are absolutely sure that the contents of summary also well-formed by XHTML.
source share