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

Re: Error template trumping other templates on import?

Subject: Re: Error template trumping other templates on import?
From: Steve <subsume@xxxxxxxxx>
Date: Mon, 27 Aug 2007 19:25:22 -0400
Re:  Error template trumping other templates on import?
I understood that general principle, but I didn't necessarily see why
a match="*" would replace more specific matches.

-Steve

On 8/27/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> Template rules in an included module have higher precedence than templates
> in an imported module, so if a node matches both, the rule in the included
> module will win.
>
> Michael Kay
> http://www.saxonica.com/
>
>
> > -----Original Message-----
> > From: Steve [mailto:subsume@xxxxxxxxx]
> > Sent: 27 August 2007 20:22
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  Error template trumping other templates on import?
> >
> > Hello there,
> >
> > I've got master.xsl which is imported by local.xsl. local.xsl
> > also includes global.xsl. global.xsl, which contains an
> > error-matching template in order to alert me in the case of
> > ambiguous/non-matches. I know several of you use a similar
> > template to catch template match problems.
> >
> > My problem is that when included into local.xsl, the error
> > template takes over all matches. However, when the templates
> > from master.xsl are placed into local.xsl, all is fine. Also,
> > when the error template is removed entirely, everything
> > matches as expected.
> >
> > Is the error matching template causing all templates in
> > master.xsl not to be imported?
> >
> > local.xsl---------------
> >
> > <?xml version='1.0' encoding="UTF-8"?>
> > <xsl:stylesheet version='1.0'
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >       <xsl:import href="../../../master/Consumers/xsl/global.xsl" />
> >       <xsl:include href="../../Global/xsl/templates.xsl" />
> >
> >       <xsl:variable name="XML"
> > select="document('../XML.xml')/node()" />
> >
> >       <xsl:param name="consumerID" />
> >       <xsl:param name="Mode" />
> > </xsl:stylesheet>
> >
> > master.xsl------------
> >
> > <?xml version='1.0' encoding="UTF-8"?>
> > <xsl:stylesheet version='1.0'
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >       <xsl:template name="master" match="/">
> >               <xsl:choose>
> >                       <xsl:when test="$R/id and $R/firstName">
> >                               <xsl:apply-templates mode="nav"
> > select="$R" />
> >                       </xsl:when>
> >                       <xsl:when test="$consumerID!=''">
> >                               <xsl:apply-templates mode="nav"
> > select="document(concat($getXML,'fields=id,firstName,lastName,
> > MI,consumerID&amp;table=Consumer_Inv&amp;key=id&amp;val=',$con
> > sumerID))/Records/Record"
> > />
> >                       </xsl:when>
> >               </xsl:choose>
> >               <xsl:call-template name="warning" />
> >               <xsl:apply-templates />
> >               <xsl:call-template name="warning" />
> >       </xsl:template>
> >       <xsl:template mode="nav" match="node()" >
> >               <fieldset id="navigation" class="oneCol">
> >                       <div>
> >                               <span id="consumerInfo">
> >                                       <xsl:value-of
> > select="firstName" />&#32;
> >                                       <xsl:value-of
> > select="MI" />&#32;
> >                                       <xsl:value-of
> > select="lastName" /> &#32;<br />
> >                                       &#35;<xsl:value-of
> > select="consumerID" />
> >                               </span>
> >                          </div>
> >                 </fieldset>
> >           </xsl:template>
> > </xsl:stylesheet>
> >
> > global.xsl ------
> > <xsl:stylesheet version='1.0'
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >         <xsl:template match="*">
> >               Error matching template
> >         </xsl:template>
> > </xsl:stylesheet>

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.