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

Problem of template priority

Subject: Problem of template priority
From: "Fabre Lambeau" <Fabre.Lambeau@xxxxxxxxxxxxx>
Date: Thu, 29 Apr 2010 01:41:37 +0100
 Problem of template priority
Hi!

I have a complex XSLT stylesheet, which does import some other ones in order
to refine/delegate some of the work depending on the type of data it finds.
This works by using templates with modes, and matching rules that are more
specific, hence increasing their default priority. However, in the main sheet
(the one that imports the others), there is a case where I want to force the
most generic template to be applied, after which it can call the others.
However, no matter what I do with the priority attribute, my processor seems
to always select the template from the imported stylesheet.

Having said that, I tried to create a simple example (below), and there I get
just the opposite effect: I can never get the imported template to apply
instead of the generic one, even though it is more selective

=== Main sheet ===

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="./special.xsl"/>

    <xsl:template match="/">
        <xsl:apply-templates mode="process-record"/>
    </xsl:template>

    <xsl:template mode="process-record" match="feed" priority="-9">
        <helloworld>
            <xsl:next-match/>
        </helloworld>
    </xsl:template>
</xsl:stylesheet>

=== Imported sheet ===

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template mode="process-record" match="feed[@type='special']"
priority="10">
        <specialone/>
    </xsl:template>
</xsl:stylesheet>

=== Document ===

<feed type="special">
	<node/>
</feed>


With this example, no matter what value I give to the priority attributes, I
always get the following result:

<helloworld>
	<specialone/>
</helloworld>

Any idea what I'm doing wrong?

FABRE LAMBEAU 

######################################################################
Attention:
This e-mail message is privileged and confidential. If you are not the
intended recipient please delete the message and notify the sender.
Any views or opinions presented are solely those of the author.

This email was scanned and cleared by NetIQ MailMarshal.
######################################################################

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.