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

Re: Further clarification re:apply-imports

Subject: Re: Further clarification re:apply-imports
From: James Clark <jjc@xxxxxxxxxx>
Date: Sun, 24 Jan 1999 08:56:23 +0700
xsl default space
The only difference between <xsl:apply-imports/> and
<xsl:apply-templates select="."/> is in which template rule is chosen to
be applied.  Once the template rule has been chosen, it's applied in the
normal way, just as if the template rule was in the root stylesheet.

Importing a stylesheet is just the same as including it, except that:

- the rules and definitions have a different "importance"

- a rule may be invoked by an xsl:apply-imports in the importing
stylesheet

The WD isn't very clear about the effect of global settings in
xsl:stylesheet in imported (or indeed included stylesheets). XT
currently ignores them.  You could say that if they weren't specified on
the root xsl:stylesheet, then the settings on first imported
xsl:stylesheet applies. However, that's inconsistent with the DTD's
having explicit defaults for these.

Nick Manson wrote:
> 
> I have noticed a couple of ambiguities in the working draft with respect to
> 'apply-imports' that didn't seem to be covered by the earlier thread on this
> topic (as far as I could tell).
> 
> 1) How does apply-imports interact with 'global' (my term) settings such as:
>         a) the indent-result, result-ns and default-space attributes?
>         b) the strip-space and preserve-space elements?
> 
> and 2) Must imported stylesheets be complete?
> 
> It would appear from the WD that I could do something like this:
> 
> <xsl:stylesheet         xmlns:xsl="http://www.w3.org/TR/WD-xsl"
>                         xmlns="http://www.w3.org/TR/REC-html40"
>                         result-ns=""
>                         default-space="preserve"
>                         indent-result="yes">
> 
>         <xsl:import href="2.xsl"/>
>         <xsl:import href="3.xsl"/>
>         <xsl:strip-space element="bar">
> 
>         <xsl:constant name="foo" value="foo"/>
> 
>         <xsl:template match="bar">
>                  <p><xsl:apply-imports/></p>
>         </xsl:template>
> 
>         ...
> 
> </xsl:stylesheet>
> 
> where 2.xsl is
> 
> <xsl:stylesheet         xmlns:xsl="http://www.w3.org/TR/WD-xsl">
>         <xsl:constant name="bar" value="bar"/>
> </xsl:stylesheet>
> 
> and where 3.xsl is
> 
> <xsl:stylesheet         xmlns:xsl="http://www.w3.org/TR/WD-xsl"
>                         xmlns:fo="http://www.w3.org/TR/WD-xsl/FO"
>                         result-ns="fo"
>                         default-space="strip"
>                         indent-result="yes">
>         ...
> </xsl:stylesheet>
> 
> This raises a couple of questions:
> 
> 1) Can the result namespace change when an applying imports?
> On the surface at least, this would seem useful.

No.  There's only one result-ns.

> 2) Which default spacing rule applies and over which section of the
> document?
> You obviously can't merge the rule 'strip whitespace from all elements' with
> the rule 'strip whitespace from no elements'.  So, either they are scoped or
> one of them wins.  The same applies for the indent-result attribute.

There's one global default-spacing rule and it comes from the root
xsl:stylesheet.

> 3) Can a rule in 3.xsl use the "foo" constant declared in 1.xsl?  Can a rule
> in 3.xsl use the constant "bar" in 2.xsl?

Yes and yes.

James



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.