Anyone here good with XSLT?

Andrej Marjan amarjan-e+AXbWqSrlAAvxtiuMwx3w at public.gmane.org
Thu Aug 5 02:08:20 UTC 2010


On August 4, 2010 06:54:04 pm Evan Leibovitch wrote:

> and an input file:
> 
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

... And all your tags are now in the XHTML namespace, not the default 
namespace.

remove the xmlns declaration and your stylsheet works.

You need to tell the stylesheet about the namespace by declaring it at the top 
and giving it an "alias" (forgot the XML terminology), then matching with that 
alias:


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

<xsl:template match="/">
         <xsl:message>Starting root</xsl:message>
        <xsl:apply-templates />
         <xsl:message>Ending root</xsl:message>
        </xsl:template>
 
<xsl:template match="xhtml:head">
        <xsl:message>Doing head</xsl:message>
         </xsl:template>

<xsl:template match="xhtml:body">
         <xsl:message>body</xsl:message>
        </xsl:template>
 
</xsl:stylesheet>
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list