[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Further clarification re:apply-impo, Nick Manson | Thread | Match pattern, Oren Ben-Kiki |
Re: Processing CDATA, James Clark | Date | Re: Processing CDATA, Kent Fitch |
Month |
Keywords