[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: namespaces problem - two transformations in one s

Subject: Re: namespaces problem - two transformations in one stylesheet possible?
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Tue, 7 Feb 2006 09:28:45 -0600
namespace and apply templates
>         <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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.