Subject: RE: Importing stylesheets Precedence Info From: "Steven Livingstone" <s.livingstone@xxxxxxxxxxxxxx> Date: Fri, 28 Jul 2000 00:59:07 +0100 |
Hi Jeni - Yes, had a look at apply-imports and also had a look at encapsulating the tenmplate matches within an apply-templates block., which supposedly you can so. The second caused a parse error for me... The first was interesting. It works fine (i think) if only one of the templates you imported have a match, but in my case, if I imported 5 stylesheet "fragments" and each one had a <xsl:template match="/"> then I think only the first imported one would be matched with apply-imports..i want to match them all. I got it working fine with modes, eg. <xsl:template match="/" mode="one of my templates">, but still working on it to see if it is the best way. Thanks for you mail ! Steven -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Jeni Tennison Sent: 28 July 2000 00:28 To: Steven Livingstone Cc: xsl-list@xxxxxxxxxxxxxxxx Subject: Re: Importing stylesheets Precedence Info Steven, >Template A overrides B, but I still want B to be executed, but as it starts >at the root, it never is and only the matching template originally in A is >executed, overriding B. I only want to import B and not actually explicity >call any templates - it should just encounter matches (and does) as it >progresses the tree. Have you tried using xsl:apply-imports [1] within A? I think that you should be able to do something like: --- in A.xsl --- <xsl:import href="B.xsl" /> <xsl:template match="/"> <!-- do something --> <xsl:apply-imports /> </xsl:template> --- --- in B.xsl --- <xsl:template match="/"> <!-- do something more --> </xsl:template> --- The imported template in B.xsl should then be called. I don't know if MSXML3 supports xsl:apply-imports, but the SDK documentation makes it look as though it does. [1] http://www.w3.org/TR/xslt#apply-imports >Therefore, I put the line > ><xsl:template match="text()|@*"/> > >which basically outputs nothing (or at least no text). >Are there side effects to this?? It is output to HTML just now, but also XML >will be an output also and I'm not sure if this method will cause me any >problems. The only big side effect I can think of is that you won't be able to process mixed content very easily. Having an empty template matching against text() means that you won't get anything if you apply templates on the children of a mixed content or text-only element. This isn't a problem with text-only elements because you can just use <xsl:value-of select="." /> instead (and you can do something similar to get the value of attributes), but mixed content would be a pain to process using simply xsl:value-of. Hope this helps, Jeni Dr Jeni Tennison Epistemics Ltd * Strelley Hall * Nottingham * NG8 6PE tel: 0115 906 1301 * fax: 0115 906 1304 * email: jeni.tennison@xxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Importing stylesheets Precedenc, Jeni Tennison | Thread | RE: Importing stylesheets Precedenc, Jeni Tennison |
Re: Importing stylesheets Precedenc, Jeni Tennison | Date | Help me getting started, tcg |
Month |