Re: [xsl] namespaces problem - two transformations in one stylesheet possible?

Subject: Re: [xsl] namespaces problem - two transformations in one stylesheet possible?
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Tue, 7 Feb 2006 09:28:45 -0600
>         <xsl:template match="/">
>                 <xsl:apply-templates select="message"/>
So it's looking for message elements that are not in a namespace.
Since there are none, it won't apply any templates and ends without
output.

You probably don't even need the selects and just have
<xsl:apply-templates/>, which will just apply templates to the
children.  Barring that,
<xsl:apply-templates select="msg:message" />
might get you a little farther since it'll actually look for something
in the namespace you want ;).

>         <xsl:template match="msg:message">
>                 <xsl:apply-templates select="m_content"/>

Again, you match in the proper namespace but apply-templates to
elements that are not in a namespace.  (Well, it's more complicated
than that I believe, but for now you just need to know you're apply
templates to elements that are not in the namespace you're thinking
of.

To help remember this just think of one of the main purposes for
namespaces, to avoid collisions.  Let's say your input document had
two different elements both called foo.   Without including the
namespace in the apply-templates, how is it supposed to know which
namespace you mean?

Jon Gorman

Current Thread