|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Precedence of template rules on xsl:import
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








