|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Including multiple XML documents with associated s
Alex,
While XSLT specifies how transformations are written and how they operate, it doesn't address how to invoke a processor to run a transformation on a document. Even the <?xml-stylesheet?> processing instruction, a sort-of standard that is recognized across XSLT-capable clients such as IE and Mozilla, isn't actually part of XSL, but is described in a separate Recommendation. There are good reasons for this: XSLT, it is hoped, should be able to perform in a wide range of different kinds of architectures. So what you've asked about, how to get a transformation to include into its result the results of running other transformations on external documents, seems like a fair enough thing to want (it could be a pretty powerful feature). But XSLT proper doesn't do this, and it isn't something that any vendor of an XSLT processor has provided for, to my knowledge. In your example, since there is no name clash between elements in files-list.xml and test-file.xml, you could simply import or include test-file.xslt into iterate-files.xslt, and it would start working for you. The way to avoid name clashes, should there be any, would be to mark the templates in test-file.xslt with their own mode, which would then be called when you process test-file.xml. Unfortunately this approach would not support the "dynamic" assignment of stylesheets to sub-documents you appear to want -- which set of templates (whether with a mode or not) is to be applied to which subdocument would have to be known ahead of time and hard-coded into iterate-files.xslt. (It could, to be sure, be switched by a template that would match the top-level elements of your sub-documents, if they were distinct; but there are a number of 'ifs' here.) If you must have run-time assignment of stylesheets to sub-documents, the clean way to do it in XSLT would probably be an extension function that would return the result of the transformation of a given source document with a given stylesheet -- in principle you could copy this into the result, or even process over it again (assuming it's returned as a node set) with the local templates. I'm not sure you want to try this, however -- it depends not only on how much responsibility you want to take on for extension development and maintenance (with all the portability issues etc.), but also on why you're trying to achieve this. Stepping back a level, and not trying to invoke the separate transformations from XSLT but rather from your calling environment, would be a very reasonable fallback to try. Cheers, Wendell At 03:45 PM 11/20/2003, you wrote: I found a helpful message in the archives by Jenni Tennison on this one, but unfortunately it doesn't address the matter of XSL stylesheets in sub-documents, rather than using the transformation templates of the governing document. ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== 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
|

Cart








