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

RE: Mixing imports and includes - specified behaviour?

Subject: RE: Mixing imports and includes - specified behaviour?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 29 Jan 2006 08:25:05 -0000
mixing stylesheets
Yes, the result is well-defined. A stylesheet that you include has higher
precedence than one that you import (directly or indirectly).

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: mazerunner@xxxxxx [mailto:mazerunner@xxxxxx] 
> Sent: 29 January 2006 01:02
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Mixing imports and includes - specified behaviour?
> 
> Hi there,
> 
> in this example I found different result from different XSLT 
> processors,
> just call main.xsl with input '<one/>':
> 
> main.xsl :
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
> <xsl:include href="first.xsl"/>
> <xsl:include href="second.xsl"/>
> <xsl:template match="/">
>   <b>
>    <xsl:for-each select="one | two | three | four">
>   <xsl:apply-templates select="."/>
>   </xsl:for-each>
>   </b>
> </xsl:template>
> </xsl:stylesheet>
> 
> first.xsl :
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
> <xsl:template match="one">
>   <xsl:apply-imports/>
>   <xsl:text>1</xsl:text>
> </xsl:template>
> <xsl:template match="two">
>   <xsl:text>2</xsl:text>
> </xsl:template>
> </xsl:stylesheet>
> 
> second.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="third.xsl"/>
> <xsl:template match="three">
>   <xsl:text>3</xsl:text>
> </xsl:template>
> <xsl:template match="four">
>   <xsl:text>4</xsl:text>
> </xsl:template>
> </xsl:stylesheet>
> 
> third.xsl :
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
> <xsl:template match="one">
>   <xsl:text>this is also one</xsl:text>
> </xsl:template>
> </xsl:stylesheet>
> 
> And this is how it works: In main.xsl I include two 
> stylesheets. In one
> stylesheet I import a template that is activated in the other.
> 
> I have following question: Is the result defined in XSLT 1.0 
> and XSLT 2.0?
> 
> Thanks in advance 
> Tobias

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.