[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
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
|