|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Does not work -- Re: FW: How To Include external XSL files into a master
Hi again (Ken and all) I attempted to follow the suggestion below but IE informs me that the MS XML parser replies back that you can not <xsl:include> or <xsl:import> at that location. I posted the same question to the xsl list but received back similar suggestions. Please advise Sincerely Jim Garrett jgarrett@n... |-----Original Message----- |From: owner-xml-dev@x... [mailto:owner-xml-dev@x...]On Behalf Of |G. Ken Holman |Sent: Sunday, February 13, 2000 7:55 AM |To: xml-dev@x... |Subject: Re: FW: How To Include external XSL files into a master XSL |file | | |At 00/02/12 13:14 -0600, Jim Garrett wrote: |>What is the syntax to link multiple child style sheets into |>a master style sheet ... | |I'll describe three ways in this response, even though your example points |to only one way. This question is better posted to | | XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list | |>e.g. |>header style sheet header.xsl |>footer style sheet footer.xsl |>data style sheet data001.xsl |>master style sheet. master.xsl |> |>this way i can always reference the master.xsl |>style sheet from any/all *.xml files |>and then link in header.xsl (this one never changes) |>then the appropriate data.xsl (this one changes) |>then link the footer.xsl (this one never changes) |> |>this way if I make any changes to the header |>or the footer, they are edited in just one file |>and reflected in all master.xsl files |> |> |><?xml version='1.0'?> |><xsl:stylesheet xmlns:xsl="http://www.w3.org> |><xsl:template match="/"> |> |><!-- include the header.xsl file here --> |><!-- how to include syntax here --> |> |><!-- include the data.xsl file here --> |><!-- how to include syntax here --> |> |><!-- include the footer.xsl file here --> |><!-- how to include syntax here --> |> |> |></xsl:template> |></xsl:stylesheet> | |Your syntax above implies you want different snippets to be |included in the |root template, which can be done for the content of a single template, but |I suspect you would rather want to include different sets of |template rules |into a single stylesheet. | |If you must have a portion of a given template in an external |file, you can |use the XML external parsed general entities, but that syntactic scheme |does not support reuse properly (though many coerce it to |try). Personally, I don't put portions of templates in external files, |rather, I use the <xsl:call-template> construct to accomplish what you are |implying. | |There are two semantic inclusion schemes at the top level of a stylesheet |(children of the stylesheet container element): inclusion and importation. | |You can use <xsl:include> to pull in top-level elements from another |stylesheet and all such constructs are included as if they were edited |in-situ (which sometimes can introduce problems accommodating template |conflict resolution). | |You can use <xsl:import> to pull in top-level elements from another |stylesheet with the concept of "importance". This confers more importance |on the importing stylesheet constructs than on the imported stylesheet |constructs, without conflict. This is a powerful way to exploit an |existing stylesheet with tweaks from an importing stylesheet. | |>also |>what is the proper syntax in the included external xsl files |> |>are they structured the same as the master.xsl file would |>e.g. |><?xml version='1.0'?> |><xsl:stylesheet xmlns:xsl="http://www.w3.org> |><xsl:template match="/"> |> |><!-- this is the header xsl file --> |> |></xsl:template> |></xsl:stylesheet> | |Yes (with the caveat that again you appear to misconstrue the use of the |declaration of the template for the root node) for included and imported |stylesheets, but no for external parsed general entities (which are merely |well-formed). Included and imported stylesheets are entire stylesheets in |their own right. | |If you are attending X-Tech in San Jose, I am teaching a two-day |hands-on-with-exercises tutorial covering 100% of the constructs of |XSLT. Please see |http://www.gca.org/attend/2000_conferences/xtech_2000/default.htm for |registration information. I am also teaching this material at other |conferences (see our web site below for the conference course |schedule) and |companies in Europe, Japan and the U.S. are licensing our XSLT training |materials for their own deliveries to their own customers. | |I hope this helps. You can get more input from many others if you post |such a question to the list I noted at the top of this message. | |.................. Ken | | |-- |G. Ken Holman mailto:gkholman@C... |Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/ |Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) |Web site: XSL/XML/DSSSL/SGML services, training, libraries, products. |Practical Transformation Using XSLT and XPath ISBN 1-894049-03-9 |Next instructor-led training: 2000-02-27/28,2000-05-11/12,2000-05-15, |- 2000-06-12,2000-06-13,2001-01-27 | *************************************************************************** This is xml-dev, the mailing list for XML developers. To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev List archives are available at http://xml.org/archives/xml-dev/threads.html ***************************************************************************
|
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
|
|||||||||

Cart








