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

RE: xsl template priority / xsl template precedence

Subject: RE: xsl template priority / xsl template precedence
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 7 Sep 2006 19:49:19 +0100
xslt template precedence
You've got one template that matches aggregate elements, and another that
matches errorresponse elements. Priorities only come into play when a node
matches more than one template rule, and that's not the case here - there's
no overlap. If you apply-templates on an aggregate, the first rule fires; if
you apply-templates on an errorresponse (with the right ancestry) the second
rule fires. Priority and precedence don't affect it.

Michael Kay

> -----Original Message-----
> From: Ralph Rauscher [mailto:rra@xxxxxxxxxxxxxxxxxxxxxxxxx] 
> Sent: 07 September 2006 18:46
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  xsl template priority / xsl template precedence
> Hi,
> seem to be stuck on this one. I'm using the following template:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> version="1.0">
>    <xsl:template match="aggregate" priority="5">
>        matched aggregate
>    </xsl:template>
>    <xsl:template match="aggregate/responses/errorresponse" 
> priority="1000">
>        matched error response
>    </xsl:template>
> </xsl:stylesheet>
> and the following input:
> <?xml version="1.0" encoding="UTF-8"?>
> <aggregate>
>    <responses>
>        <errorresponse>
>            some error
>        </errorresponse>
>    </responses>
> </aggregate>
> I'd assume that given the priority attributes on the 
> templates, the match="aggregate/responses/errorresponse" 
> would get chosen by the XSLT processor. However, the result 
> is that - no matter what I try - the processor always uses 
> the match="aggregate" template also that thing has lower 
> priority and is also less specific than the other one.
> Anyone any ideas why that happens? I tried different 
> processors, all with the same result.
> Ralph

Current Thread


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.
First Name
Last Name
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.