|
Subject: [xsl] Precedence of template rules on xsl:import From: "Marcus Andersson" <marcan@xxxxxxx> Date: Fri, 4 Jul 2003 13:44:10 +0200 |
Hi
I'm constructing a stylesheet that imports some other stylesheets (and also takes some params). When I apply the stylesheet to the document the button template in the button.xslt will always be applied for all buttons in the application document regardless if they are a child of the toolbar or not. If I change the order of the imports in the main stylesheet then it works as expected. But there is a but here, namely that the main stylesheet will be generated from a config file so I want that the order of the imports shouldn't matter. Is it possible to accomplish or do I have to impose some order in the config files and/or in the stylesheet generator?
I guess I could change the match attribute in the button template to "button[not(parent::toolbar or parent::group/parent::toolbar)]" but that's kind of ugly (I think) and I must also exclude all other possible button variations as well so this approach could get really tedious if I want many ways to use the button element.
regards,
/Marcus
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<xsl:stylesheet xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="../../gui/xslt/toolbar.xslt"/>
<xsl:import href="../../gui/xslt/button.xslt"/>
.
.
.
</xsl:stylesheet>
The imported stylesheets has the following template structure:
-- toolbar.xslt --
<xsl:template match="toolbar">
...
</xsl:template>
<xsl:template match="toolbar/group">
...
</xsl:template>
<xsl:template match="button[parent::toolbar or parent::group/parent::toolbar]">
...
</xsl:template>
-- button.xslt --
<xsl:template match="button">
...
</xsl:template>
It's applied to a document with the following example structure:
<application ...>
<toolbar>
<button .../>
<button .../>
...
</toolbar>
<content>
<button .../>
</content>
</application>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] xpath question, G. Ken Holman | Thread | Re: [xsl] Precedence of template ru, David Carlisle |
| Re: [xsl] Re: Re: XSLT Architecture, David Carlisle | Date | RE: [xsl] XSLT Architecture: Next S, Didier PH Martin |
| Month |